4 評論
Editing the serialized part of the metadata wasn't straightforward so I come up with this command:
aws backup get-recovery-point-restore-metadata --backup-vault-name Default --recovery-point-arn arn:aws:ec2:eu-south-1::image/ami-001a2a3a4a00005aa | jq '.RestoreMetadata | del (.SecurityGroupIds, .SubnetId)' | jq '.NetworkInterfaces = (.NetworkInterfaces | fromjson | map(. + { Description: "Primary network interface" }) | map(del(.NetworkInterfaceId, .SecondaryPrivateIpAddressCount, .AssociatePublicIpAddress, .PrivateIpAddress)) | @json) ' > restore.json
What this command does:
- extracts RestoreMetadata
- removes from it the fields SecurityGroupIds and SubnetId
- then deserialize and replaces the content of NetworkInterfaces removing NetworkInterfaceId, SecondaryPrivateIpAddressCount, AssociatePublicIpAddress and PrivateIpAddress
- serializes NetworkInterfaces and creates the json file for the restore job:
aws backup start-restore-job --region eu-south-1 --recovery-point-arn arn:aws:ec2:eu-south-1::image/ami-001a2a3a4a00005aa --iam-role-arn "arn:aws:iam::123412341234:role/service-role/AWSBackupDefaultServiceRole" --metadata file://restore.json
YMMV: for example this might not work if the primary ENI has two private addresses.
回答 10 個月前
Thank you for your comment. We'll review and update the Knowledge Center article as needed.
The Private IP Address should be retained.
In the step1, PrivateIpAddress is 172.16.1.5.
In the step2, PrivateIpAddress is 172.16.2.5.
回答 2 個月前
Thank you for your comment. We'll review and update the Knowledge Center article as needed.
相關內容
- 已提問 10 個月前
- 已提問 1 年前
- AWS 官方已更新 1 年前