ecs: Bottlerocket support for AsgCapacityProvider
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the bug
I have this C# code that is defining Auto-Scaling group for ECS cluster with Amazon Image:
```C#
_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](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecs-readme.html#bottlerocket), 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_
Contributor guide
Research direction
Start at the AsgCapacityProvider and BottleRocketImage entry points referenced in the issue, then trace how the Bottlerocket machine image is configured for ECS registration. Reproduce the ASG setup with BottleRocketImage and compare it with AmazonLinux2023; done means a Bottlerocket instance created by the capacity provider automatically registers with the ECS cluster.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, csharp, typescript
- Domain
- cloud, devops, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100