-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aws-ecs: appends invalid ecs user data #32469
Comments
The MachineImageType enum supports 2 values as of now - Using AWS CLI command {
"Parameters": [
{
"Name": "/aws/service/ecs/optimized-ami/amazon-linux-2023/recommended/image_id",
"Type": "String",
"Value": "ami-0a357ea20d7b79c2c",
"Version": 61,
"LastModifiedDate": "2024-11-18T08:07:53.585000-08:00",
"ARN": "arn:aws:ssm:us-east-1::parameter/aws/service/ecs/optimized-ami/amazon-linux-2023/recommended/image_id",
"DataType": "text"
}
],
"InvalidParameters": []
} Below CDK code could be used to reproduce the issue (assuming we could SSH to EC2 instance launched by ECS task): import * as cdk from 'aws-cdk-lib';
import * as ecs from 'aws-cdk-lib/aws-ecs';
import * as ec2 from 'aws-cdk-lib/aws-ec2';
import * as autoscaling from 'aws-cdk-lib/aws-autoscaling';
export class CdktestStackNew extends cdk.Stack {
constructor(scope: cdk.App, id: string, props?: cdk.StackProps) {
super(scope, id, props);
const vpc = new ec2.Vpc(this, 'EcsVpc');
/*
const ecsAmi = ec2.MachineImage.lookup({
name: '/aws/service/ecs/optimized-ami/amazon-linux-2023/recommended/image_id'
});
*/
const asg = new autoscaling.AutoScalingGroup(this, 'EcsAsg', {
vpc: vpc,
instanceType: new ec2.InstanceType('t2.xlarge'),
machineImage: ecs.EcsOptimizedImage.amazonLinux2023(),
desiredCapacity: 3
});
const capacityProvider = new ecs.AsgCapacityProvider(this, 'EcsCapacityProvider', {
autoScalingGroup: asg
});
const cluster = new ecs.Cluster(this, 'MyEcsCluster', {
vpc: vpc
});
cluster.addAsgCapacityProvider(capacityProvider);
}
} @cheruvian Please validate the finding above. Also share if you were able to gather logs, perhaps from |
Hi team, upon trying to fix this issue, another one come up:
Which means aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service doesn't make sense ? Please help correct me on this point. |
Describe the bug
ECS appends the following to the asg userdata
This command is invalid on the most recent versions of the ECS optimized AMI
Expanding to look at the whole code block the comments seem to be out of place
aws-cdk/packages/aws-cdk-lib/aws-ecs/lib/cluster.ts
Lines 567 to 569 in 59e96a3
Regression Issue
Last Known Working CDK Version
No response
Expected Behavior
Should have valid commands in userdata. Is a service restart not needed?
Current Behavior
Command fails and suggests using
systemctl
Reproduction Steps
Deploy an ECS cluster backed by ASG
Possible Solution
At a minimum reorder the comments, not sure what command it is intending to run, perhaps
sudo netfilter-persistent save
which isn't installed on the latest EBS optimized GPU AMIAdditional Information/Context
No response
CDK CLI Version
2.134.0 (build 265d769)
Framework Version
No response
Node.js Version
v20.10.0
OS
OSX
Language
TypeScript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: