Skip to content

Instantly share code, notes, and snippets.

@AndrewBestbier
Created March 5, 2020 10:55
Show Gist options
  • Select an option

  • Save AndrewBestbier/92139f8ef8422e70b4bfc8601115fbe8 to your computer and use it in GitHub Desktop.

Select an option

Save AndrewBestbier/92139f8ef8422e70b4bfc8601115fbe8 to your computer and use it in GitHub Desktop.
FirstInstance:
Type: AWS::EC2::Instance
Properties:
ImageId: ami-0389b2a3c4948b1a0
InstanceType: t2.micro
SecurityGroups:
- !Ref InstanceSecurityGroup # (1)
UserData:
Fn::Base64:
Fn::Sub: |
#!/bin/bash -xe
yum update -y
yum install -y httpd
systemctl start httpd
systemctl enable httpd
echo "Hello from $(hostname -f)" > /var/www/html/index.html
InstanceSecurityGroup: # (2)
Type: AWS::EC2::SecurityGroup # (3)
Properties:
GroupDescription: Letting HTTP into our instance
SecurityGroupIngress:
- FromPort: 80 # (4)
ToPort: 80
CidrIp: 0.0.0.0/0 # (5)
IpProtocol: tcp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment