4 commenti
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.
risposta 10 mesi fa
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.
risposta 3 mesi fa
Thank you for your comment. We'll review and update the Knowledge Center article as needed.
Contenuto pertinente
- Come posso assegnare un indirizzo IP privato primario personalizzato alla mia istanza di Amazon EC2?AWS UFFICIALEAggiornata 2 anni fa
- AWS UFFICIALEAggiornata 3 anni fa
- AWS UFFICIALEAggiornata 2 anni fa