How can I copy an AMI to another account using Packer?


I have two AWS Accounts:

  1. Test Account
  2. Prod Account

I am creating an AMI using Packer in the Test Account and want to copy the AMI to the Prod Account after that.

How can I use Packer to do that and also remove the actual AMI after the job is done?

I already checked following questions but they didn’t resolve my query:

  1. How do I bulk copy AMI AWS account number permissions from one AMI image to another?
  2. how to copy AMI from one aws account to other aws account?


You can accomplish this behavior by using the ami_users directive in packer. This will allow the specified accounts to access the created AMIs from the source account.

If you are looking to have a deep copy of the AMIs in each account (distinct IDs) then you will have to re-run packer build with credentials into the other account.

Leave a Reply