Packer: AWS AMI Platform Reading as Other Linux when Created from Amazon Linux 2 Base AMI

Created on 16 Oct 2019  ยท  5Comments  ยท  Source: hashicorp/packer

Overview of the Issue

When creating a custom Amazon Linux 2 AMI and using the base Amazon Linux 2 Base AMI as the source AMI, the resulting AMI shows "Other Linux" under the platform. It should display "Amazon Linux 2"

image

Reproduction Steps

packer build test_awslinux2_custom.json

Packer version

Packer v1.4.4

Simplified Packer Buildfile

test_awslinux2_custom.json:

{
"builders": [
    {
      "type": "amazon-ebs",
      "ami_name": "awslinux2-golden-{{isotime | clean_resource_name}}",
      "tags": {
        "OS_Version": "Amazon Linux 2",
        "Base_AMI_Name": "{{ .SourceAMIName }}",
        "Extra": "{{ .SourceAMITags.TagName }}"
      },
      "region": "us-west-2",
      "ami_regions": ["us-west-2"],
      "instance_type": "t3.medium",
      "encrypt_boot": true,
      "source_ami_filter": {
        "filters": {
          "virtualization-type": "hvm",
          "name": "amzn2-ami-hvm-2.0.*-x86_64-gp2",
          "root-device-type": "ebs"
        },
        "owners": ["amazon"],
        "most_recent": true
      },
      "ssh_username": "ec2-user"
    }]
}

Operating system and Environment details

MacOS - Mojave - v10.14.6

bug buildeamazon upstream-bug

Most helpful comment

It seems like Amazon just parses the AMI name (thanks https://www.turnkeylinux.org/comment/12501 for the hint)

Example with ubuntu:

"bionic 20191205 (build 1576658994)" -> Platform=Other Linux
"Ubuntu bionic 20191205 (build 1576660092)" -> Platform=Ubuntu

In your case, your AMI name contains "awslinux2", while stock Amazon Linux AMIs seem to be named with "amzn2" instead.

All 5 comments

Hi, thanks for reaching out. I'm 99% sure this is a bug with Amazon, not Packer. I see their developer forums full of people asking this question, but they're pretty light on answers unfortunately. The API call we use to create the image doesn't even allow us to overwrite that field so we couldn't be messing it up even if we wanted to.

I don't think there's anything we can do about this, so I'm going to close the issue.

It seems like Amazon just parses the AMI name (thanks https://www.turnkeylinux.org/comment/12501 for the hint)

Example with ubuntu:

"bionic 20191205 (build 1576658994)" -> Platform=Other Linux
"Ubuntu bionic 20191205 (build 1576660092)" -> Platform=Ubuntu

In your case, your AMI name contains "awslinux2", while stock Amazon Linux AMIs seem to be named with "amzn2" instead.

ooh TIL -- thanks @matrey

I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mwhooker picture mwhooker  ยท  3Comments

brettswift picture brettswift  ยท  3Comments

sourav82 picture sourav82  ยท  3Comments

Tensho picture Tensho  ยท  3Comments

DanielBo picture DanielBo  ยท  3Comments