- Newest
- Most votes
- Most comments
If you want the volumes to have the same tags as the instance, you can enable the PropagateTagsToVolumeOnCreation property on the EC2::Instance to achieve that.
If you want different tags, you'll have to create the volumes separately from the instance with the resource type AWS::EC2::Volume and use AWS::EC2::VolumeAttachment to attach them to your instance.
In AWS CloudFormation, you cannot directly add tags to EBS volumes through the BlockDeviceMappings of an AWS::EC2::Instance resource. However, you can create the EBS volume as a separate AWS::EC2::Volume resource and then attach it to the instance. This approach allows you to add tags to the EBS volume.
You can modify your CloudFormation template to achieve this:Create the EBS Volume as a separate resource: Define the EBS volume with the desired tags. Attach the EBS Volume to the EC2 instance: Use an AWS::EC2::VolumeAttachment resource to attach the volume to the instance.
