botocore.exceptions.ClientError:调用DeleteSnapshot操作时发生错误(InvalidSnapshot.NotFound):无
我尝试用str()包围结果
client = boto3.client('ec2',region_name='us-east-1')
snapshots = client.describe_snapshots(OwnerIds=[ownerid])
for snapshot in snapshots ['Snapshots']:
snapshot_time=snapshot['StartTime'].date()
current_time=datetime.datetime.now().date()
diff_time = current_time - snapshot_time
if diff_time.days > 30:
id = str(snapshot['SnapshotId'])
client.delete_snapshot(SnapshotId=str(id),DryRun=False)