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"
packer build test_awslinux2_custom.json
Packer v1.4.4
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"
}]
}
MacOS - Mojave - v10.14.6
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.
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:
In your case, your AMI name contains "awslinux2", while stock Amazon Linux AMIs seem to be named with "amzn2" instead.