@@ -19,15 +19,35 @@ REGION="$(get_instance_region)"
1919
2020source /etc/os-release
2121OS=" ${ID}${VERSION_ID} "
22- [[ " ${OS} " != " amzn2" ]] && echo " [ERROR] Unsupported OS '${OS} '. Configuration supported only on Amazon Linux 2." && exit 1
22+
23+ if [[ " ${OS} " != " amzn2" && " ${OS} " != " amzn2023" ]]; then
24+ echo " [ERROR] Unsupported OS '${OS} '. Configuration supported only on Amazon Linux 2 and Amazon Linux 2023."
25+ exit 1
26+ fi
2327
2428echo " [INFO] Starting: instance configuration for US isolated region"
2529
2630echo " [INFO] Starting: installation of packages from amazon Linux 2 repository for US isolated region"
2731
28- REPOSITORY_DEFINITION_FILE=" /etc/yum.repos.d/tmp-amzn2-iso.repo"
32+ REPOSITORY_DEFINITION_FILE=" /etc/yum.repos.d/tmp-${OS} -iso.repo"
33+
34+ if [[ " ${OS} " == " amzn2023" ]]; then
35+ cat > ${REPOSITORY_DEFINITION_FILE} << REPO_DEFINITION
36+ [amzn2023-iso]
37+ name=Amazon Linux 2023 isolated Region repository
38+ mirrorlist=http://al2023-repos-$awsregion -de612dc2.s3.$awsregion .$awsdomain /core-iso/mirrors/$releasever /$basearch /mirror.list
39+ priority=10
40+ enabled=1
41+ repo_gpgcheck=0
42+ type=rpm
43+ gpgcheck=0
44+ gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-amazon-linux-2023
45+ REPO_DEFINITION
2946
30- cat > ${REPOSITORY_DEFINITION_FILE} << REPO_DEFINITION
47+ dnf install -y amazon-linux-repo-iso ca-certificates-iso
48+ echo -n " " > sudo tee /etc/dnf/vars/dualstack
49+ else
50+ cat > ${REPOSITORY_DEFINITION_FILE} << REPO_DEFINITION
3151[amzn2-iso]
3252name=Amazon Linux 2 isolated region repository
3353mirrorlist=http://amazonlinux.\$ awsregion.\$ awsdomain/\$ releasever/core-\$ awsregion/latest/\$ basearch/mirror.list
@@ -39,7 +59,9 @@ mirrorlist_expire=300
3959report_instanceid=yes
4060REPO_DEFINITION
4161
42- yum --disablerepo=" *" --enablerepo=" amzn2-iso" install -y " *-${REGION} "
62+ yum --disablerepo=" *" --enablerepo=" ${OS} -iso" install -y " *-${REGION} "
63+ fi
64+
4365rm -f ${REPOSITORY_DEFINITION_FILE}
4466
4567echo " [INFO] Complete: installation of packages from amazon Linux 2 repository for US isolated region"
0 commit comments