A Vagrantfile and associated scripts for easy AWS deployment.
More information here http://trengrj.net/2016/06/18/deploy-aws.html.
Initial AWS Preliminaries
I'm assuming you already have an AWS Account and also have an access key / secret key pair downloaded from AWS with at least permission to create EC2 instances.
The first step is to install the AWS CLI. This allows you to interact with AWS through the command line. I'm using pacman here for example but these packages are pretty easy to install on any machine.
sudo pacman -S aws-cli
Configure aws-cli with your keys and region:
Test it out:
aws ec2 describe-instances
You should see a list of the AWS instances you already have running.
Next make sure you have vagrant and vagrant-aws on your system and install the
sudo pacman -S vagrant vagrant plugin install vagrant-aws vagrant box add dummy https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box
The dummy box is an empty vagrant box as we will be using an AWS ami (in this case Ubuntu 14.04 LTS) as our base image.
Download my sample git repo:
git clone https://github.com/trengrj/deploy-aws && cd deploy-aws
This repository consists of a
Vagrantfile which specifies how the server is creates, a
www directory which is copied as the webroot to the new server, and a set of scripts for managing aws environment variables, keypairs, and security groups.
The scripts will read your current credentials from the same directory AWS CLI uses.
Create a new security group (note this creates a security group called web-ssh which allows inbound HTTP, HTTPS, and SSH.
Create a new keypair.
vagrant up --provider=aws
You can view ip of the server as follows.