Paolo
Paolo

Reputation: 26034

Copy ami to different region with cli

I am trying to copy an ami from one region to a different region through the AWS CLI.

The following command works fine for copying an ami to the same region:

aws ec2 copy-image --name ami-copy-test --source-image-id ami-123... --source-region us-east-1

but I am trying to copy to a different region, us-east-2 for instance.


There doesn't seem to be a --destination-region flag. The documentation page: https://docs.aws.amazon.com/cli/latest/reference/ec2/copy-image.html states:

You specify the destination Region by using its endpoint when making the request.

But what does this actually mean?

Upvotes: 2

Views: 1652

Answers (1)

user8908370
user8908370

Reputation:

You are on the right page, just continue to read

from https://docs.aws.amazon.com/cli/latest/reference/ec2/copy-image.html
...
This example copies the specified AMI from the us-east-1 region to the ap-northeast-1 region.

Command:

aws ec2 copy-image --source-image-id ami-5731123e --source-region us-east-1 --region ap-northeast-1 --name "My server"

Upvotes: 6

Related Questions