Skip to content

Instantly share code, notes, and snippets.

@AHaydar
Created November 16, 2020 05:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AHaydar/3c1e79e7bc3c1463b07e7d1e7d7d9fb0 to your computer and use it in GitHub Desktop.
Save AHaydar/3c1e79e7bc3c1463b07e7d1e7d7d9fb0 to your computer and use it in GitHub Desktop.
CloudFormation
Resources:
Ec2Instance:
Type: AWS::EC2::Instance
Properties:
InstanceType: t2.micro
ImageId: ami-0947d2ba12ee1ff75 # Amazon Linux AMI in us-east-1
KeyName: ec2-instances
Tags:
- Key: Name
Value: My EC2 Instance
- Key: Owner
Value: Ali
SecurityGroups:
- !Ref MySecurityGroup
MySecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: Open Ports 22 and 80
SecurityGroupIngress:
- IpProtocol: tcp
FromPort: '22'
ToPort: '22'
CidrIp: <your IP>/32
- IpProtocol: tcp
FromPort: '80'
ToPort: '80'
CidrIp: 0.0.0.0/0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment