Milestone 10 AWS and Ansible - absentee-neptune/SYS-480 GitHub Wiki
AWS
-
On the computer make sure the AWS CLI package is installed
- If not, here is the link: https://aws.amazon.com/cli/
-
Log into AWS and copy/paste the current session credentials for AWS CLI into ~/.aws/credentials
-
Test Connectivity to AWS account with the following command:
aws sts get-caller-identity
-
Upload a self-created public key to AWS EC2 account with the following command:
aws ec2 import-key-pair --key-name keyname --public-key-material fileb://~/path/to/file.pub
To perform a dry run of an AWS EC2 command, use the following tag at the end:
--dry-run
-
Create a security group with the following command:
aws ec2 create-security-group --group-name SecurityGroupName --description "Used AWS-CLI to create this"
-
Create ingress rules for a security group with the following command:
aws ec2 authorize-security-group-ingress --group-name SecurityGroupName --protocol tcp --port 22 --cidr 0.0.0.0/0
-
Deploy an instance with the following command:
aws ec2 run-instances --image-id ami-0885b1f6bd170450c --instance-type t2.micro --count 1 --subnet-id subnet-282bab09 --key-name keyname --security-group-ids sg-0000
-
SSH into an instance with the following command:
ssh -i keyname.pem [email protected]
Ansible
- Create a free hostname at the following website: https://www.freenom.com/
- Use the Public IP of the Instance when creating the DNS Records
- Copy the public key of the AWS instance to it using
ssh-copy-id
to ensure password-less log-ins - Ping the AWS instance with the hostname, and install and start Nginx using Ansible
Milestone Completion
Milestone Reflection
Milestone 10 Demo - Part 1
Milestone 10 Demo - Part 2