我需要使用 Powershell-AWS Sdk for AWS Backup 进行报告。
实际上我有当前的报告:
我想在左侧为每个带有 VolumeId 的原始匹配添加 Name Instance TAG 列,以便更友好地使用,并且如果 Instance 是否备份,则更容易阅读。
谢谢。
# AWS Credentials
Set-AWSCredential -ProfileName XXXX
Set-DefaultAWSRegion -Region XXXXX
$date = (get-date -Format "MM-dd-yyyy" (Get-Date).AddDays(-1)) #Last day
$Body = @"
<style>
body {
background-color: #CAD2D3;
}
</style>
<h1><img src="https://i.ibb.co/cvHLWfN/transparent-aws-logo.png" alt="transparent-aws-logo" width="189" height="69" border="0" /> <span style="color: #000000;"><strong>AWS BACKUP STATUS</strong></span></h1>
<p>The following report was run on $(get-date).</p>
"@
$Header = @"
<style>
TABLE {border-width: 2px; border-style: solid; border-color: black; border-collapse: collapse;}
TH {border-width: 2px; padding: 3px; border-style: solid; border-color: black; background-color: #6495ED;}
TD {border-width: 2px; padding: 3px; border-style: solid; border-color: black;}
</style>
"@
Get-BAKBackupJobList -ByCreatedAfter $date | Select-Object -Property @{Label = 'VolumeId'; Expression = { $_.ResourceArn.substring($_.ResourceArn.length - 21) } }, @{Label = 'BackupSizeInGB'; Expression = { [int]($_.BackupSizeInBytes / 1GB) } }, BackupJobId, CreationDate, CompletionDate, State |
ConvertTo-Html -Head $Header -Body $Body | ForEach-Object {
$PSItem -replace "<td>COMPLETED</td>", "<td style='background-color:#7CFC00'>COMPLETED</td>" } | out-file "E:\Report\AWSBackup\Report_AWSBackup-$date.html"
巴斯托斯AWS。