EC2 Copy Snapshot Ignoring Destination Region Parameter
See original GitHub issueWhen I attempt to call copy_snapshot using the DestinationRegion parameter, it is ignored in favour of the region that the Lambda is run from.
For example, I wanted to copy a snapshot from us-east-1 to us-west-2, so I made this call similar to the one in the boto3 docs:
response = ec2.copy_snapshot(
SourceSnapshotId='snapshotId',
DestinationRegion='us-west-2',
SourceRegion='us-east-1',
Description = "TEST"
)
The response that I receive looks correct, however instead of the copy going to us-west-2, it winds up in the region from which I call the Lambda which is generally us-east-1.
When I make the call using the AWS CLI, I get the same result as I expect (copy goes to us-west-2), so I feel like this is an issue on boto’s end.
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
CopyDBSnapshot - Amazon Relational Database Service
Copies the specified DB snapshot. The source DB snapshot must be in the available state. You can copy a snapshot from one AWS...
Read more >python - boto - copy snapshot to another region - Stack Overflow
You can use the copy_snapshot() method in the EC2 module to copy snapshots ... EC2 Copy Snapshot Ignoring Destination Region Parameter.
Read more >copy-snapshot — AWS CLI 2.1.29 Command Reference
Copies a point-in-time snapshot of an EBS volume and stores it in Amazon S3. You can copy a snapshot within the same Region,...
Read more >AWS EBS Ultimate Guide & 5 Bonus Features to Try
Move the snapshot with the command aws ec2 copy-snapshot. Provide the parameters --source-region, --source-snapshot-id, --destination-region (optional, but ...
Read more >community.aws.ec2_snapshot_copy module – Copies an EC2 ...
Copies an EC2 Snapshot from a source region to a destination region. Requirements . The below requirements are needed on the host...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I was going to point out the inconsistency in the boto3 documentation (DestinationRegion is described in the Parameters section, but not used in the Request Syntax section)… but now that I read this…
If I read correctly, you’re saying the ec2 client.copy_snapshot does not use the DestinationRegion at all, because it uses the “current” region (from the client’s session) as the destination. And, indeed, it requires the SourceRegion argument (feels like we could call this a “pull” model).
If I’m writing a script to run, for instance, on my machine, I can establish a session with the source region, look among the snapshots to find one I wish to copy (grab its id), then establish a separate/new session with the destination region, and use the ec2 client copy_snapshot to perform the copy. Feels a bit clunky, but …hmm… ok…
But if I am a Lambda? If I’m a Lambda running in the source region, then it’s easy to look at the snapshots available to find the one I want to copy, but then I have to make a separate session with the destination region, and use that client’s copy_snapshot method. Right?
'Cause if my Lambda was running in the destination region (in which case the client on which I call copy_snapshot can use the implicit current region), I don’t think I have a way to get the list of available snapshots from the source region (no filter in DescribeSnapshots talks about regions)… except by opening a separate session with the source region and using a client from that session …
It does feel clunky, doesn’t it?
This is possible as @FrancescoRizzi suggested, lambda function can be run from destination region, but set the region parameter in the code to the source region where you have the snasphots.
Here, the lambda function is created in eu-west-1(Ireland), and SourceSnapshotId is a snap Id from eu-central-1(Frankfurt)