Skip to content
This repository was archived by the owner on Nov 19, 2025. It is now read-only.

Commit ebba242

Browse files
committed
Add logging while creating cluster and merge functions
1 parent 9a6b2dc commit ebba242

File tree

2 files changed

+8
-16
lines changed

2 files changed

+8
-16
lines changed

ecs-cli/modules/cli/cluster/cluster_app.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ func retrieveInstanceType(cfnParams *cloudformation.CfnStackParams) (string, err
379379
param, err := cfnParams.GetParameter(ParameterKeyInstanceType)
380380

381381
if err == cloudformation.ParameterNotFoundError {
382+
logrus.Infof("Defaulting instance type to %s", cloudformation.DefaultECSInstanceType)
382383
return cloudformation.DefaultECSInstanceType, nil
383384
}
384385
if err != nil {

ecs-cli/modules/clients/aws/amimetadata/client.go

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -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.
7973
func (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

110106
func 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

114114
func 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

Comments
 (0)