Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
using !ref to assign security group resource to EC2 Instance
---
Resources:
TekLoonTestInstance:
Type: AWS::EC2::Instance
Properties:
AvailabilityZone: ap-southeast-1a
ImageId: ami-02f26adf094f51167
InstanceType: t2.micro
SecurityGroups:
- !Ref HTTPSecurityGroup
HTTPSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: Enable port 80 and port 443
SecurityGroupIngress:
- CidrIp: 0.0.0.0/0
FromPort: 80
IpProtocol: tcp
ToPort: 80
- CidrIp: 0.0.0.0/0
FromPort: 443
IpProtocol: tcp
ToPort: 443
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment