(aws_batch): The default value of Launch Template is default but should be latest
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the bug
The property of Compute Environment > LaunchTemplateSpecification > Version is set by the module `aws-batch` as Default. But when I update the launch template with CDK. The module selects the first version not the latest
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-computeenvironment-launchtemplatespecification.html
> The version number of the launch template, $Latest, or $Default.
> If the value is $Latest, the latest version of the launch template is used. If the value is $Default, the default version of the launch template is used.
### Expected Behavior
The Module `aws-batch` should set Compute Environment > LaunchTemplateSpecification > Version to `$Latest`
### Current Behavior
The property of Compute Environment > LaunchTemplateSpecification > Version is set by the module `aws-batch` as Default.
### Reproduction Steps
```
multipart_user_data = ec2.MultipartUserData()
with open(from_root("cdk", "constructs", "user_data_xray.txt")) as f:
user_data_xray_txt = f.read()
multipart_user_data.add_part(
ec2.MultipartBody.from_raw_body(
content_type='text/x-shellscript; charset="us-ascii"',
body=user_data_xray_txt,
)
)
launch_template = ec2.LaunchTemplate(
self,
"lt-" + proc_name,
launch_template_name="batch-ffmpeg-lt-" + proc_name,
user_data=multipart_user_data,
)
compute_environment = batch.ManagedEc2EcsComputeEnvironment(
self,
"batch-ec2-compute-environment-" + proc_name,
vpc=ec2_vpc,
images=[{"image": ec2_ami}],
instance_classes=batch_compute_instance_classes,
use_optimal_instance_classes=False,
update_to_latest_image_version=True,
instance_role=batch_compute_env_instance_role,
terminate_on_update=False,
launch_template=launch_template,
security_groups=[ec2_vpc_sg],
vpc_subnets=ec2_vpc_subnets,
spot=True,
spot_bid_percentage=100,
maxv_cpus=4096,
)
```
### Possible Solution
_No response_
### Additional Information/Context
_No response_
### CDK CLI Version
2.110.1 (build 0d37f0d)
### Framework Version
_No response_
### Node.js Version
v18.0.0
### OS
Macos
### Language
Python
### Language Version
_No response_
### Other information
_No response_
Contributor guide
Research direction
Start at the aws-batch module and the ManagedEc2EcsComputeEnvironment construct shown in the reproduction. Inspect the synthesized Compute Environment LaunchTemplateSpecification and its Version value, then check nearby tests if available. Done means the generated CloudFormation uses $Latest instead of the default launch-template version.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud, infrastructure
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100