ephemeral ubuntu development environment in an ami
deployed in an aws autoscaling group configured in terraform
built with packer, ansible and terraform
postgresql, docker, nodejs 12, oh-my-zsh, ready out of the box
configured via benmangold/dev-server-role and Ansible Galaxy
requires AWS_ACCESS_KEY_ID
and AWS_SECRET_ACCESS_KEY
to be available in environment
validate packer json, and then build a new ami with packer (packer calls ansible)
make packer
is the same as:
make validate
make build
initialize terraform, deploy ami configured in terraform/main.tf
, and connect with ssh. then, destroy the infrastructure
make init
make apply
make connect
make destroy
server validation is run by Packer with Goss
. Goss validation configs are in goss.yml
.
First, Goss is installed via Ansible with benmangold/install-goss-role in ubuntu/ansible/playbook.yml
:
...
- name: Goss Install
import_role:
name: install-goss-role
...
then, goss/goss.yml is copied and validated via Packer provisioners in ubuntu/ubuntu-ami.json
:
...
{
"type": "file",
"source": "goss/goss.yml",
"destination": "/tmp/goss.yml"
},
{
"type": "shell",
"inline":[
"goss --gossfile=/tmp/goss.yml validate"
]
},
...
this repo includes configs to deploy the ami to an ec2 in an autoscaling group
note the configs are currently not secure for production use, but allow for http requests to the asg and ssh access to servers
initial terraform configs are ripped out of benmangold/tf-up-and-running
do not leave this server running until security has been improved
make validate
- validate packer json
make build
- build ami via packer:
make init
- initialize terraform
make deploy
- deploys ami via terraform apply
make destroy
- destroys current infrastructure
make connect
- connects to a running, tagged ec2 via ssh
a new ami will build with commits to main
wsl setup
exec ssh-agent zsh # start ssh-agent if not started
ssh-add # add local ssh keys key
ssh-add ~/.ssh/my-ssh-key.pem # add ec2-auth key
be sure to forward your local ssh keys with -A
ssh -A [email protected]
to artis3n/cloud-hackbox for inspiration and reference