【发布时间】:2019-11-12 05:37:40
【问题描述】:
我可以在我的 ec2 中使用 python 和 boto3 创建快照,但我找不到为创建的快照添加名称的方法。我正在使用文档中的这段代码来创建快照。如何为创建的快照添加名称,就像我们为卷手动创建快照时一样?
import boto3
ec2 = boto3.resource('ec2', region_name = 'eu-central-1')
snapshot = ec2.create_snapshot(
Description='Aws test snapshot',
VolumeId='vol-0e3a3275b2b669g67',
TagSpecifications=[
{
'ResourceType': 'snapshot',
'Tags': [
{
'Key': 'sony',
'Value': 'Test by sony'
},
]
},
],
DryRun=False
)
【问题讨论】:
标签: python-3.x amazon-ec2 boto3 snapshot