You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have a bunch of Launch Templates that include a variety of Block Device Mappings.
Some of these LTs only have a single mapping that looks something like
For these LTs, we want to create new versions that are the same as existing one except they need to drop this mapping, i.e. have a new version of the LT without any mappings.
We've tried various ways to achieve this, and believe (and confirmed with AWS Support) that the right way would be to basically just drop the entire BlockDeviceMappings -- that is, take the existing LaunchTemplateData from the Source LT Version, remove BlockDeviceMappings, from it, and then pass it to create_launch_template_version as the new LaunchTemplateData.
We confirmed this sequence of steps works as expected with the AWS CLI, but consistently fails with Boto3 for some reason.
With Boto3, the new resulting LT version still has the same mapping as the original version.
Regression Issue
Select this option if this issue appears to be a regression.
Expected Behavior
Expectation is that new LT version will be same as the Source one, but without any BlockDeviceMappings.
Current Behavior
The current behavior (with Boto3) is that the BlockDeviceMappings section shows up in the new LT version despite it being dropped from LaunchTemplateData when calling create_launch_template_version
Reproduction Steps
importboto3LT="lt-018d11ccb4e9ef84c"# base version that has /dev/sda1BASE_VERSION="45"c=boto3.client("ec2")
current_lt=c.describe_launch_template_versions(
LaunchTemplateId=LT, Versions=[BASE_VERSION]
)["LaunchTemplateVersions"][0]
assert"BlockDeviceMappings"incurrent_lt["LaunchTemplateData"]
print(current_lt["LaunchTemplateData"]["BlockDeviceMappings"])
# -> [{'DeviceName': '/dev/sda1', 'Ebs': {'VolumeSize': 10, 'VolumeType': ''}}]# ^ shows that the base version has /dev/sda1 with 10GB EBS# Now delete the entire BlockDeviceMappings sectiondelcurrent_lt["LaunchTemplateData"]["BlockDeviceMappings"]
# Confirm it's not there:assert"BlockDeviceMappings"notincurrent_lt["LaunchTemplateData"]
# Create new LT version based on one without BlockDeviceMappingsnew_lt=c.create_launch_template_version(
LaunchTemplateId=LT,
SourceVersion=BASE_VERSION,
VersionDescription="itenne-manual",
LaunchTemplateData=current_lt["LaunchTemplateData"],
)
print(new_lt["LaunchTemplateVersion"]["VersionNumber"])
print(new_lt["LaunchTemplateVersion"]["LaunchTemplateData"]["BlockDeviceMappings"])
# -> [{'DeviceName': '/dev/sda1', 'Ebs': {'VolumeSize': 10, 'VolumeType': ''}}]# ^ IT'S STILL IN THE NEW VERSION !
Describe the bug
We have a bunch of Launch Templates that include a variety of Block Device Mappings.
Some of these LTs only have a single mapping that looks something like
For these LTs, we want to create new versions that are the same as existing one except they need to drop this mapping, i.e. have a new version of the LT without any mappings.
We've tried various ways to achieve this, and believe (and confirmed with AWS Support) that the right way would be to basically just drop the entire
BlockDeviceMappings
-- that is, take the existingLaunchTemplateData
from the Source LT Version, removeBlockDeviceMappings
, from it, and then pass it tocreate_launch_template_version
as the newLaunchTemplateData
.We confirmed this sequence of steps works as expected with the AWS CLI, but consistently fails with Boto3 for some reason.
With Boto3, the new resulting LT version still has the same mapping as the original version.
Regression Issue
Expected Behavior
Expectation is that new LT version will be same as the Source one, but without any
BlockDeviceMappings
.Current Behavior
The current behavior (with Boto3) is that the
BlockDeviceMappings
section shows up in the new LT version despite it being dropped fromLaunchTemplateData
when callingcreate_launch_template_version
Reproduction Steps
Attaching output of this script with Boto debug logging enabled
boto3_debug_output.txt
Possible Solution
No response
Additional Information/Context
As noted above, if I do the same thing but with AWS CLI, it works as expected.
Essentially something like this:
SDK version used
1.35.78
Environment details (OS name and version, etc.)
macOS Ventura 13.7.1 [Apple M2 Ultra]
The text was updated successfully, but these errors were encountered: