Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is the AMI ID retained after the copy from account A to account B ? #12

Closed
nitrocode opened this issue Oct 16, 2020 · 1 comment
Closed

Comments

@nitrocode
Copy link

nitrocode commented Oct 16, 2020

Hi @martinbaillie . Thank you so much for creating this post processor. I found this while looking for post processors that could copy AMIs to a list of accounts and copy the tags of those AMIs to the accounts. And an extra benefit is encryption!

  • When the AMIs are copied to the other accounts, are the AMI IDs different from the original account or are the same AMI IDs retained?
    • I'm guessing yes because it's a copy of an AMI.
  • Are there additional packer IAM permissions to get this to work ? Does the user/role that runs the packer job require certain IAM permissions or role assumption for the other accounts ?
@nitrocode nitrocode changed the title Question regarding the copying of the AMI Is the AMI ID retained after the copy from account A to account B ? Oct 16, 2020
@vishalbasra
Copy link

In my experience the AMI ID changes in that you have two ami's in the destination account

==> amazon-ebs.windows-base-image (ami-copy): [us-east-1] Copying ami-<id-generated-by-packer> to account <accountid> (encrypted: false)
==> amazon-ebs.windows-base-image (ami-copy): Going to wait for image to be in available state
==> amazon-ebs.windows-base-image (ami-copy): Waiting one minute (1/30) for AMI to become available, current state: pending for image ami-0b8cc040176c68a2b on account 504055967630
==> amazon-ebs.windows-base-image (ami-copy): Waiting one minute (2/30) for AMI to become available, current state: pending for image ami-0b8cc040176c68a2b on account 504055967630
==> amazon-ebs.windows-base-image (ami-copy): Waiting one minute (3/30) for AMI to become available, current state: pending for image ami-0b8cc040176c68a2b on account 504055967630
==> amazon-ebs.windows-base-image (ami-copy): Waiting one minute (4/30) for AMI to become available, current state: pending for image ami-0b8cc040176c68a2b on account 504055967630
==> amazon-ebs.windows-base-image (ami-copy): Waiting one minute (5/30) for AMI to become available, current state: pending for image ami-0b8cc040176c68a2b on account 504055967630
==> amazon-ebs.windows-base-image (ami-copy): [us-east-1] Finished copying ami-<id-generated-by-packer> to <accountid> (copied id: ami-<new-id>)

In that the original AMI generated is copied over to the destination account with the same id but without tags, this image has the source account listed as the owner. This happens in packer now when you use https://www.packer.io/docs/builders/amazon/ebs#ami_users and the snapshot modification attribute.
Then there is the image the plugin creates with the tags denoted by ami-<new-id> which has the source as the destination account itself.
So you essentially get two AMIs in the destination accounts specified by target account id

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

No branches or pull requests

3 participants