Last active
February 21, 2021 22:56
-
-
Save 11philip22/e38d35ad6c379ff5dfe1e3945345cb13 to your computer and use it in GitHub Desktop.
aws oracle linux plain
This file contains 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
{ | |
"Resources": { | |
"EC2": { | |
"Type": "AWS::EC2::Instance", | |
"Metadata": { | |
"AWS::CloudFormation::Init" : { | |
"configSets" : { | |
"full_install" : [ | |
"setup_epel", | |
"install_utils" | |
] | |
}, | |
"setup_epel": { | |
"commands": { | |
"install_epel": {"command": "sudo amazon-linux-extras install epel -y"}, | |
"enable_epel": {"command": "sudo yum-config-manager --enable epel"} | |
} | |
}, | |
"install_utils": { | |
"commands": { | |
"update": {"command": "sudo yum update -y"}, | |
"utils": {"command": "sudo yum install -y git tmux"}, | |
"python3": {"command": "sudo yum install -y python3 python3-pip"} | |
} | |
} | |
} | |
}, | |
"Properties": { | |
"InstanceType": "t3.micro", | |
"ImageId": "ami-0bd39c806c2335b95", | |
"KeyName": "PC", | |
"SecurityGroups": [ | |
{"Ref": "SSHSecurityGroup"} | |
], | |
"UserData": { "Fn::Base64": { | |
"Fn::Join": ["", [ | |
"#!/bin/bash -xe\n", | |
"# Install the files and packages from the metadata\n", | |
"/opt/aws/bin/cfn-init -v ", | |
" --stack ", {"Ref": "AWS::StackName"}, | |
" --resource ProxyEC2 ", | |
" --configsets full_install ", | |
" --region ", {"Ref": "AWS::Region"}, "\n" | |
]]} | |
} | |
} | |
}, | |
"SSHSecurityGroup": { | |
"Type": "AWS::EC2::SecurityGroup", | |
"Properties": { | |
"GroupDescription": "Enable SSH access via port 22", | |
"SecurityGroupIngress": [{ | |
"IpProtocol": "tcp", | |
"FromPort" : "22", | |
"ToPort" : "22", | |
"CidrIp" : "0.0.0.0/0" | |
}] | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment