hashicorp / packer-plugin-amazon

Packer plugin for Amazon AMI Builder
https://www.packer.io/docs/builders/amazon
Mozilla Public License 2.0
72 stars 110 forks source link

Unable to create AMI from Marketplace source with subscribed credentials #442

Open avidalto opened 10 months ago

avidalto commented 10 months ago

Description

I am encountering an issue when using Packer to create an AMI from a source AMI in the AWS Marketplace. Here are the details:

Problem

Packer is configured with a set of AWS credentials, and the source AMI in the AWS Marketplace requires a subscription. I can launch an instance from the source AMI. However, when attempting to use Packer with the exact same credentials, I encounter the following error:

==> amazon-ebs.aws: Error launching source instance: OptInRequired: In order to use this AWS Marketplace product you need to accept terms and subscribe. To do so please visit https://aws.amazon.com/marketplace/pp?sku=cotnnspjrsi38lfn8qo4ibnnm

Steps to Reproduce

  1. Subscribe to the source AMI in the AWS Marketplace.
  2. Use the same AWS credentials on the command line to launch an instance from the source AMI (successfully).
  3. Configure Packer with the same AWS credentials and attempt to create an AMI.
  4. Encounter the "OptInRequired" error mentioned above.

Expected Behavior

Packer should be able to use the subscribed credentials to create an AMI from the source AMI in the AWS Marketplace without encountering the "OptInRequired" error.

Environment

Packer Version: 1.9.4 Operating System: Ubuntu

Community Note

When filing a bug, please include the following headings if possible. Any example text in this template can be deleted.

Overview of the Issue

A paragraph or two about the issue you're experiencing.

Reproduction Steps

Steps to reproduce this issue

Packer version

From packer version

Simplified Packer Template

If the file is longer than a few dozen lines, please include the URL to the gist of the log or use the Github detailed format instead of posting it directly in the issue.

Operating system and Environment details

OS, Architecture, and any other information you can provide about the environment.

Log Fragments and crash.log files

Include appropriate log fragments. If the log is longer than a few dozen lines, please include the URL to the gist of the log or use the Github detailed format instead of posting it directly in the issue.

Set the env var PACKER_LOG=1 for maximum log detail.