Post-processor to publish AMI IDs to AWS SSM Parameter Store
- Dominant language
- Go
- Stars
- 15.8k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
#### Community Note
* Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request
* Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
* If you are interested in working on this issue or have submitted a pull request, please leave a comment
#### Description
Add a first-party Packer post-processor (in the Amazon plugin) that publishes the freshly baked AMI ID to AWS Systems Manager Parameter Store, so EC2 Launch Templates can reference an SSM parameter (``resolve:ssm:...`` or full ARN) instead of hard-coding AMI IDs. Parameter Store is regional; Packer should support publishing to one or many regions.
#### Use Case(s)
- Image factory bakes AMIs in a build account (A), shares AMIs to workload accounts (B), and wants Auto Scaling Groups to pick up new AMIs automatically at instance launch via Launch Templates resolving SSM parameters.
- Multi-region fleets: keep the same parameter path per region (e.g., ``/golden/web/latest_ami``) and publish region-specific AMI IDs to each region’s Parameter Store.
- Reduce CI glue and drift by avoiding ad-hoc ``shell-local`` + CLI calls; keep publishing inside Packer’s build graph with clear failures/outputs.
#### Potential configuration
```
post-processor "aws-ssm-parameter" {
name = "/golden/web/latest_ami" # same path in that region
region = "us-east-1" # publish destination
value = "${build.AMI_IDS["us-east-1"]}" # AMI chosen for that region
overwrite = true
data_type = "aws:ec2:image"
tier = "Advanced" # if you plan to RAM-share
tags = {
Purpose = "GoldenAMI"
Source = "packer"
}
}
```
Multi-region publish (replicates the same path per region):
```
post-processor "aws-ssm-parameter" {
name = "/golden/web/latest_ami"
regions = ["us-east-1", "us-west-2"]
values = {
us-east-1 = "${build.AMI_IDS["us-east-1"]}"
us-west-2 = "${build.AMI_IDS["us-west-2"]}"
}
overwrite = true
data_type = "aws:ec2:image"
}
```
Launch Template (consumer side) examples:
- Same-account parameter: ``ImageId = "resolve:ssm:/golden/web/latest_ami"``
- Cross-account parameter (shared via RAM): ``ImageId = "resolve:ssm:arn:aws:ssm:REGION:ACCOUNT_A_ID:parameter/golden/web/latest_ami"``
#### Potential References
- Launch Templates resolving SSM parameters (incl. cross-account via ARN): https://docs.aws.amazon.com/autoscaling/ec2/userguide/using-systems-manager-parameters.html
- Parameter Store AMI alias (``data_type = aws:ec2:image``): https://docs.aws.amazon.com/systems-manager/latest/userguide/parameter-store-ec2-aliases.html
- Sharing parameters across accounts via AWS RAM (Advanced tier): https://docs.aws.amazon.com/systems-manager/latest/userguide/parameter-store-shared-parameters.html
Contributor guide
Assessment
This issue has not been assessed yet.