Moto: copy_snapshot does not write tags to destination resource

Created on 30 Apr 2020  路  2Comments  路  Source: spulec/moto

Thanks for this great library. extremely helpful to me!

mock = moto.mock_ec2()
mock.start()
sclient = boto3.client('ec2', region_name='us-west-2') # source client
dclient = boto3.client('ec2', region_name='us-east-1') # destination client
v_id = sclient.create_volume(AvailabilityZone='us-west-2a',
                             Size=7)['VolumeId']
snap_id = sclient.create_snapshot(
            VolumeId=v_id, TagSpecifications=snapshot_tags)['SnapshotId']
d_snap_id = dclient.copy_snapshot(
            SourceSnapshotId=snapshot_id,
            SourceRegion=source_region,
            TagSpecifications=[{'ResourceType': 'snapshot', 'Tags': spec}]
            )['SnapshotId']
dclient.describe_snapshots(SnapshotIds=[d_snap_id])
{'Snapshots': [{'Description': 'None', 'Encrypted': False, 'OwnerId': '111122223333', 'Progress': '100%', 'SnapshotId': 'snap-733b6b87', 'StartTime': datetime.datetime(2020, 4, 30, 17, 10, 52, tzinfo=tzutc()), 'State': 'completed', 'VolumeId': 'vol-00228c20', 'VolumeSize': 7, 'Tags': []}], 'ResponseMetadata': {'RequestId': '59dbff89-35bd-4eac-99ed-be587EXAMPLE', 'HTTPStatusCode': 200, 'HTTPHeaders': {'server': 'amazon.com'}, 'RetryAttempts': 0}}

^ notice, no tags in the destination resource

moto 1.3.14
boto3 1.12.46

enhancement

Most helpful comment

This is now part of moto >= 1.3.16.dev53

All 2 comments

Thanks @drewmullen - will mark this as an enhancement

This is now part of moto >= 1.3.16.dev53

Was this page helpful?
0 / 5 - 0 ratings