@@ -36,12 +36,6 @@ const (
3636 amazonLinux2X86GPURecommendedParameterName = "/aws/service/ecs/optimized-ami/amazon-linux-2/gpu/recommended"
3737)
3838
39- // Architecture types of EC2 instances.
40- const (
41- ArchitectureTypeARM64 = "arm64"
42- ArchitectureTypeX86 = "x86"
43- )
44-
4539// AMIMetadata is returned through ssm:GetParameters and can be used to retrieve the ImageId
4640// while launching instances.
4741//
@@ -78,9 +72,11 @@ func NewMetadataClient(commandConfig *config.CommandConfig) Client {
7872// GetRecommendedECSLinuxAMI returns the recommended Amazon ECS-Optimized AMI Metadata given the instance type.
7973func (c * metadataClient ) GetRecommendedECSLinuxAMI (instanceType string ) (* AMIMetadata , error ) {
8074 if isARM64Instance (instanceType ) {
75+ logrus .Infof ("Using Arm ecs-optimized AMI because instance type was %s" , instanceType )
8176 return c .parameterValueFor (amazonLinux2ARM64RecommendedParameterName )
8277 }
8378 if isGPUInstance (instanceType ) {
79+ logrus .Infof ("Using GPU ecs-optimized AMI because instance type was %s" , instanceType )
8480 return c .parameterValueFor (amazonLinux2X86GPURecommendedParameterName )
8581 }
8682 return c .parameterValueFor (amazonLinux2X86RecommendedParameterName )
@@ -108,7 +104,11 @@ func (c *metadataClient) parameterValueFor(ssmParamName string) (*AMIMetadata, e
108104}
109105
110106func isARM64Instance (instanceType string ) bool {
111- return architectureFor (instanceType ) == ArchitectureTypeARM64
107+ r := regexp .MustCompile ("a1\\ .(medium|\\ d*x?large)" )
108+ if r .MatchString (instanceType ) {
109+ return true
110+ }
111+ return false
112112}
113113
114114func isGPUInstance (instanceType string ) bool {
@@ -123,12 +123,3 @@ func isGPUInstance(instanceType string) bool {
123123 }
124124 return false
125125}
126-
127- func architectureFor (instanceType string ) string {
128- r := regexp .MustCompile ("a1\\ .(medium|\\ d*x?large)" )
129- if r .MatchString (instanceType ) {
130- logrus .Infof ("Using Arm ecs-optimized AMI because instance type was %s" , instanceType )
131- return ArchitectureTypeARM64
132- }
133- return ArchitectureTypeX86
134- }
0 commit comments