deployment: Avoid aws-marketplace amis getting the latest ubuntu AMI in external turn CF

pull/803/head
cruizba 2023-04-06 17:26:11 +02:00
parent 91fd7c09ef
commit 898d12e695
1 changed files with 2 additions and 1 deletions

View File

@ -150,7 +150,8 @@ Resources:
def handler(event, context): def handler(event, context):
try: try:
response = boto3.client('ec2').describe_images(Filters=[ response = boto3.client('ec2').describe_images(Filters=[
{'Name': 'name', 'Values': [event['ResourceProperties']['Name']]} {'Name': 'name', 'Values': [event['ResourceProperties']['Name']]},
{'Name': 'owner-alias', 'Values': ['amazon']}
]) ])
amis = sorted(response['Images'], key=lambda x: x['CreationDate'], reverse=True) amis = sorted(response['Images'], key=lambda x: x['CreationDate'], reverse=True)
id = amis[0]['ImageId'] id = amis[0]['ImageId']