How to set Inbound Rule Name via Cloudformation in AWS
I'm trying to set the name of this Ingress Rule in my Security Group:
I've tried two methods and looked at the documentation and can't find a way to do it. I've tried:
SecurityGroupIngress:
- IpProtocol: icmp
FromPort: 0
ToPort: -1
Name: Allow ICMP
Description: Allow ICMP
CidrIp: 0.0.0.0/0
And I've tried this:
SecurityGroupIngress:
- IpProtocol: icmp
FromPort: 0
ToPort: -1
Description: Allow ICMP
CidrIp: 0.0.0.0/0
Tags:
- Key: Name
Value: Allow ICMP
I've looked for examples, and I've looked through the documentation and I don't see a reference to this. Any ideas?
Solution 1:
The Name
that you see in the console is the Name tag of the resource. Currently in CloudFormation both AWS::EC2::SecurityGroupIngress
and Ingress
objects in AWS::EC2::SecurityGroup
don't support tags (Tags for individual rules is a recent feature, added in July 2021. CloudFormation doesn't support all new features on release). If this is a crucial requirement you can use Lambda backed custom CloudFormation resources to create an AWS Lambda function which will tag the resource for you.