Skip to content
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

ecs: Bottlerocket support for AsgCapacityProvider #29432

Open
JZechy opened this issue Mar 11, 2024 · 1 comment
Open

ecs: Bottlerocket support for AsgCapacityProvider #29432

JZechy opened this issue Mar 11, 2024 · 1 comment
Labels
@aws-cdk/aws-ecs Related to Amazon Elastic Container effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2

Comments

@JZechy
Copy link

JZechy commented Mar 11, 2024

Describe the bug

I have this C# code that is defining Auto-Scaling group for ECS cluster with Amazon Image:

_cluster.AddAsgCapacityProvider(new AsgCapacityProvider(this, "asg-provider", new AsgCapacityProviderProps
        {
            AutoScalingGroup = new AutoScalingGroup(this, "auto-scaling", new AutoScalingGroupProps
            {
                AutoScalingGroupName = _clusterName,
                Vpc = _vpc,
                InstanceType = InstanceType.Of(InstanceClass.T3, InstanceSize.NANO),
                MinCapacity = 0,
                MaxCapacity = 5,
                MachineImage = EcsOptimizedImage.AmazonLinux2023(),
                InstanceMonitoring = Monitoring.DETAILED,
                SecurityGroup = ConstructSecurityGroup(),
                Role = CreateInstanceRole()
            }),
            CapacityProviderName = _clusterName,
            EnableManagedTerminationProtection = false,
            EnableManagedDraining = false,
            EnableManagedScaling = false
        }), new AddAutoScalingGroupCapacityOptions());

Security Group defines all requested connections. Role is defining everything that the ECS instance needs to work. Once the instance is created by ASG, is automtically registered with the ECS cluster and it's working. It is there, task is deployed, I can connect to the instance.

However if I change the MachineImage to new BottleRocketImage() as described in cdk docs, the registration of new EC2 instace stops working.

Expected Behavior

Bottlerocket instances should automatically register to the ECS cluster.

Current Behavior

Bottlerocket instance is created by ASG, but is not registered with the ECS cluster.

Reproduction Steps

Create a new ECS cluster with ASG as described above and select Bottlerocket as Machine Image.

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.131.0

Framework Version

No response

Node.js Version

20.10.0

OS

Fedora 39

Language

.NET

Language Version

.NET 8

Other information

No response

@JZechy JZechy added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Mar 11, 2024
@github-actions github-actions bot added the @aws-cdk/aws-ecs Related to Amazon Elastic Container label Mar 11, 2024
@pahud
Copy link
Contributor

pahud commented Mar 11, 2024

According to this, BottleRocket image is only available with addCapacity() rather than addAsgCapacityProvider().

Before we clarify it in the doc I think you can reference this sample from the AWS Community Builder @neilkuan.

Making this a p2 feature request and we welcome your PRs if you successfully provision it.

@pahud pahud added p2 feature-request A feature should be added or improved. effort/medium Medium work item – several days of effort and removed bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Mar 11, 2024
@pahud pahud changed the title (ecs): How to define ECS cluster using Bottlerocket image? ecs: Bottlerocket support for AsgCapacityProvider Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-ecs Related to Amazon Elastic Container effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

No branches or pull requests

2 participants