I am currently evaluating, how to do automated AMI Baking in my AWS account.
I noticed the AWS-UpdateLinuxAmi
AWS SSM Document, which seems like its kind of made for this task.
But it requires the AMIID as an Input parameter. I want to base my baked AMIs on the latest Amazon Linux 2 Image. Ideally without having to maintain my automation tasks.
Is this possible with Amazon SSM, or should I look for another solution?
SSM documents can automatically get parameters from SSM Parameter Store, as shown in the docs:
LatestAmi:
type: String
default: >-
{{ssm:/aws/service/ami-windows-latest/Windows_Server-2016-English-Full-Base}}
description: The latest Windows Server 2016 AMI queried from the public parameter.
The example shows how to get latest ami for windows, but you can do the same for Amazon Linux 2. The SSM parameters for AL2 are listed and explained here.