Skip to content

add variables for custom source AMI owner, ssh interface, IAM profile, and subnet#654

Open
pjaudiomv wants to merge 1 commit intoaws:mainfrom
radiusmethod:feat/custom-source-ami-support
Open

add variables for custom source AMI owner, ssh interface, IAM profile, and subnet#654
pjaudiomv wants to merge 1 commit intoaws:mainfrom
radiusmethod:feat/custom-source-ami-support

Conversation

@pjaudiomv
Copy link

Summary

Add four new optional variables to allow building ECS-optimized AMIs from a custom source AMI (e.g. a hardened/STIG compliant base) without modifying the templates. All variables default to the existing behavior, so this is a non-breaking change.

Implementation details

Four variables are added to variables.pkr.hcl:

  • source_ami_owners - replaces the hardcoded owners = ["amazon"] in each source_ami_filter block
  • ssh_interface - replaces the hardcoded ssh_interface = "public_ip" in each source block
  • iam_instance_profile - adds optional IAM instance profile support to the build instance; omitted when empty
  • subnet_id - adds optional subnet placement for the build instance; omitted when empty

The corresponding source blocks in al2023.pkr.hcl, al2023arm.pkr.hcl, al2023gpu.pkr.hcl, and al2023neu.pkr.hcl are updated to reference these variables.

Testing

Validated by building the AL2023 ECS-optimized AMI against a custom STIG-hardened Amazon Linux 2023 source AMI using SSM Session Manager (ssh_interface=session_manager) with a custom IAM instance profile and subnet. The default configuration (building from Amazon's official AMI over public IP) is unchanged.

New tests cover the changes:

Description for the changelog

  • enhancement - Add variables for custom source AMI owner, SSH interface, IAM instance profile, and subnet to support building from different base AMIs

Licensing

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@pjaudiomv pjaudiomv requested a review from a team as a code owner March 18, 2026 22:11
@pjaudiomv pjaudiomv force-pushed the feat/custom-source-ami-support branch 2 times, most recently from 5046494 to 79e6fa8 Compare March 18, 2026 22:31
@harishxr harishxr enabled auto-merge (rebase) March 18, 2026 22:48
auto-merge was automatically disabled March 18, 2026 23:51

Head branch was pushed to by a user without write access

@pjaudiomv pjaudiomv force-pushed the feat/custom-source-ami-support branch from 79e6fa8 to ccbe0fa Compare March 18, 2026 23:51
harishxr
harishxr previously approved these changes Mar 19, 2026
@harishxr harishxr enabled auto-merge (rebase) March 19, 2026 22:39
auto-merge was automatically disabled March 20, 2026 22:33

Head branch was pushed to by a user without write access

…, and subnet

Change log update

rm changelog entry

packer fmt

update variable descriptions

simplify logic
@pjaudiomv pjaudiomv force-pushed the feat/custom-source-ami-support branch 3 times, most recently from 153ac9c to e036790 Compare March 20, 2026 23:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants