Skip to content

Commit

Permalink
AL2022 AMI name - drop volume type, add kernel version
Browse files Browse the repository at this point in the history
  • Loading branch information
yinyic committed Oct 17, 2022
1 parent f1f93ec commit 5a2f854
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion al2022.pkr.hcl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
locals {
ami_name_al2022 = "${var.ami_name_prefix_al2022}-hvm-2022.0.${var.ami_version}-x86_64-ebs"
ami_name_al2022 = "${var.ami_name_prefix_al2022}-hvm-2022.0.${var.ami_version}${var.kernel_version_al2022}-x86_64"
}

source "amazon-ebs" "al2022" {
Expand Down
2 changes: 1 addition & 1 deletion al2022arm.pkr.hcl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
locals {
ami_name_al2022arm = "${var.ami_name_prefix_al2022}-hvm-2022.0.${var.ami_version}-arm64-ebs"
ami_name_al2022arm = "${var.ami_name_prefix_al2022}-hvm-2022.0.${var.ami_version}${var.kernel_version_al2022arm}-arm64"
}

source "amazon-ebs" "al2022arm" {
Expand Down
2 changes: 1 addition & 1 deletion al2022neu.pkr.hcl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
locals {
ami_name_al2022neu = "${var.ami_name_prefix_al2022}-neuron-hvm-2022.0.${var.ami_version}-x86_64-ebs"
ami_name_al2022neu = "${var.ami_name_prefix_al2022}-neuron-hvm-2022.0.${var.ami_version}${var.kernel_version_al2022}-x86_64"
}

source "amazon-ebs" "al2022neu" {
Expand Down
4 changes: 4 additions & 0 deletions generate-release-vars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,12 @@ ami_name_al2_arm=$(aws ec2 describe-images --region "$region" --owner amazon --i
# AL2022
ami_id_al2022_x86=$(aws ssm get-parameters --region "$region" --names /aws/service/ami-amazon-linux-latest/al2022-ami-minimal-kernel-default-x86_64 --query 'Parameters[0].[Value]' --output text)
ami_name_al2022_x86=$(aws ec2 describe-images --region "$region" --owner amazon --image-id "$ami_id_al2022_x86" --query 'Images[0].Name' --output text)
kernel_version_al2022_x86=$(grep -o -e "-kernel-[1-9.]*" <<<"$ami_name_al2022_x86")

# AL2022 ARM (use describe-images for now until al2022 ARM SSM parameters are ready)
ami_id_al2022_arm=$(aws ec2 describe-images --region "$region" --owners amazon --filters "Name=name,Values=al2022-ami-minimal-2022.0.*" "Name=architecture,Values=arm64" --query "reverse(sort_by(Images, &CreationDate))[0].ImageId" --output text)
ami_name_al2022_arm=$(aws ec2 describe-images --region "$region" --owner amazon --image-id "$ami_id_al2022_arm" --query 'Images[0].Name' --output text)
kernel_version_al2022_arm=$(grep -o -e "-kernel-[1-9.]*" <<<"$ami_name_al2022_arm")

# Get the latest AL2022 distribution release
# xmllint is required to find the latest distribution release from releasemd.xml in us-west-2
Expand All @@ -75,5 +77,7 @@ source_ami_al2 = "$ami_name_al2_x86"
source_ami_al2arm = "$ami_name_al2_arm"
source_ami_al2022 = "$ami_name_al2022_x86"
source_ami_al2022arm = "$ami_name_al2022_arm"
kernel_version_al2022 = "$kernel_version_al2022_x86"
kernel_version_al2022arm = "$kernel_version_al2022_arm"
distribution_release_al2022 = "$distribution_release_al2022"
EOF
2 changes: 2 additions & 0 deletions release.auto.pkrvars.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ source_ami_al2arm = "amzn2-ami-minimal-hvm-2.0.20220912.1-arm64-ebs"
source_ami_al2022 = "al2022-ami-minimal-2022.0.20220928.0-kernel-5.15-x86_64"
source_ami_al2022arm = "al2022-ami-minimal-2022.0.20220928.0-kernel-5.15-arm64"
distribution_release_al2022 = "2022.0.20220928"
kernel_version_al2022 = "-kernel-5.15"
kernel_version_al2022arm = "-kernel-5.15"
10 changes: 10 additions & 0 deletions variables.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,16 @@ variable "distribution_release_al2022" {
description = "Amazon Linux 2022 distribution release."
}

variable "kernel_version_al2022" {
type = string
description = "Amazon Linux 2022 kernel version."
}

variable "kernel_version_al2022arm" {
type = string
description = "Amazon Linux 2022 ARM kernel version."
}

variable "ami_name_prefix_al1" {
type = string
description = "Outputted AMI name prefix."
Expand Down

0 comments on commit 5a2f854

Please sign in to comment.