Create an AMI of the instance
aws ec2 create-image \
--instance-id <i-0123456789abcdef> \
--name "AMI-Image-Name" \
--description "AMI Image of EC2 created from Source AWS Account to Destination AWS Account" \
--region <region-id> \
--profile <optional-profile>
Above command will output an Image ID. We will share this image with the destination AWS Account. Image creation might take some time. When the image is created run following command to give permission to destination AWS account.
Give AMI Permission to destination AWS Account
aws ec2 modify-image-attribute \
--image-id <AMI-ID-retrieved-from-above-command> \
--region <region-id> \
--launch-permission "Add=[{UserId=<destination-aws-account-id>}]" \
--profile infolytxdev
Reference:
Top comments (0)