Created
July 28, 2020 08:08
-
-
Save darko-mesaros/e7b557fb63b7a0e5f3e90189e209d61a to your computer and use it in GitHub Desktop.
A CloudFormation template that creates a simple EC2 instance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWSTemplateFormatVersion: "2010-09-09" | |
Description: > | |
This is my template that creates a simple EC2 instance | |
# Parameters | |
Parameters: | |
InstanceName: | |
Type: String | |
Description: Name your EC2 instance - dont | |
KeyPair: | |
Type: AWS::EC2::KeyPair::KeyName | |
Description: The KeyPair name to access the EC2 instance | |
InstanceType: | |
Type: String | |
Description: The Type of the EC2 instance we will use | |
AllowedValues: | |
- t2.micro | |
- t3.micro | |
AMI: | |
Type: AWS::EC2::Image::Id | |
Description: The AMI ID to be used with our EC2 instance | |
Default: ami-0c3e74fa87d2a4227 | |
Resources: | |
EC2Instance: | |
Type: AWS::EC2::Instance | |
Properties: | |
ImageId: !Ref AMI | |
InstanceType: !Ref InstanceType | |
KeyName: !Ref KeyPair | |
UserData: | |
Fn::Base64: | |
#!/bin/bash | |
yum -y update | |
yum -y install httpd | |
service httpd start | |
Tags: | |
- Key: Name | |
Value: !Ref InstanceName | |
Outputs: | |
EC2InstanceIP: | |
Description: The instance IP | |
Value: !GetAtt EC2Instance.PublicIp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment