hashicorp / hashicorp/packer-plugin-amazon

amazon_import post-processor fails: architecture=arm64 has an invalid format

Open
#264 13 comments 2 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
91
Forks
141
Avg merge
2d 18h
Merged PRs (30d)
3

Description

#### Overview of the Issue

Importing a Fedora 37 arm64 (aarch64) image fails with an error message from AWS indicating the architecture value is invalid. Googling for the error suggests:

* Despite the docs saying otherwise, you cannot specify an architecture with the `ImportImage` call (presumably this is what is being used) - in the cli this would be equivalent to `aws ec2 import-image --architecture arm64`.
* What does work is the `ImportSnapshot` call - in the cli this would be like `aws ec2 import-snapshot --disk-container Format=VHD,UserBucket="{S3Bucket=YOUR-BUCKET,S3Key=S3_OBJECT_NAME}"`
* When the status reports complete, that may be followed by a `RegisterImage` call - the cli equivalent of `aws ec2 register-image --cli-input-json "$( fedora-aws-arm64: Running post-processor: artifice
==> fedora-aws-arm64 (artifice): Using these artifact files: /tmp/fedora-aws-arm64.vhdx
==> fedora-aws-arm64: Running post-processor: amazon-import
fedora-aws-arm64 (amazon-import): Uploading /tmp/fedora-aws-arm64.vhdx to s3://IMPORT-BUCKET-NAME/packer-import-1662046985.vhdx
fedora-aws-arm64 (amazon-import): Completed upload of /tmp/fedora-aws-arm64.vhdx to s3://IMPORT-BUCKET-NAME/packer-import-1662046985.vhdx
Build 'fedora-aws-arm64' errored after 3 minutes 11 seconds: 1 error(s) occurred:

* Post-processor failed: Failed to start import from s3://IMPORT-BUCKET-NAME/packer-import-1662046985.vhdx: retry count exhausted. Last err: InvalidParameter: Parameter architecture = arm64 has an invalid format.
status code: 400, request id: c781da9e-39d2-4df8-ba61-8d176a5cae85

==> Wait completed after 3 minutes 11 seconds

==> Some builds didn't complete successfully and had errors:
--> fedora-aws-arm64: 1 error(s) occurred:

* Post-processor failed: Failed to start import from s3://IMPORT-BUCKET-NAME/packer-import-1662046985.vhdx: retry count exhausted. Last err: InvalidParameter: Parameter architecture = arm64 has an invalid format.
status code: 400, request id: c781da9e-39d2-4df8-ba61-8d176a5cae85

==> Builds finished but no artifacts were created.
```

***However***, passing the (already uploaded) S3 object into the aws CLI results in (eventual) `aws ec2 describe-import-snapshot-tasks` success:

`aws ec2 import-snapshot --disk-container Format=VHDX,UserBucket="{S3Bucket=IMPORT-BUCKET-NAME,S3Key=packer-import-1662046985.vhdx}"`

Following that with a `aws ec2 register-image --cli-input-json "$(

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.