Skip to content

nilan3/cloudformation-ec2-cluster

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cloudformation-ec2-cluster

Alt text

Usage

See Medium article for a detailed walk through. https://medium.com/@nilanthanb1994/aws-ec2-cluster-using-cloudformation-3f2106faa51

  1. Create your EC2 key on the AWS console and save pem file in your local directory.
  2. Update REGION, EC2_KEY_NAME, EC2_AMI_ID as appropriate.
  3. Deploy cloudformation set up stack
bash scripts/cfn-deploy.sh setup
  1. Navigate to the CloudFormation section on the AWS console and execute the changeset created for the setup-stack.
  2. Once setup stack is deployed, run master stack.deployment.
bash scripts/cfn-deploy deploy
  1. Navigate to the CloudFormation section on the AWS console again and execute the changeset created for the master-stack.
  2. Wait for deployment to complete then check the node IPs on the EC2 section of the AWS console.

Use Bastion as the SSH jump host to reach private instances.

ssh-agent bash
ssh-add ${PATH_TO_PEM_FILE}
BASTION_HOST=$(aws ec2 describe-instances --filters 'Name=tag:Name,Values=Public-Node-Bastion' --output text --query 'Reservations[].Instances[].PublicIpAddress')
ssh -o ForwardAgent=yes -o ProxyCommand="ssh -q -W %h:%p ec2-user@${BASTION_HOST}" ec2-user@xx.x.x.xxx

Future Improvements:

  • Scope down cloudformation iam role
  • Enable network-acl-stack into vpc-stack.

About

Deploy a secure EC2 cluster on AWS using CloudFormation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages