For quickly iterating on ec2 instance bootstrapping without having to go through the CFN deployment cycle:
- Install sshfs or its mac port
- Deploy via CFN with minimal userdata script
- Mount the
ec2-users
home directory in your project (we will use aremote
directory) - Copy the ops code into the
remote
directory - Edit files in the
remote
directory with your editor of choice set up as you have in your local env - Test your changes by executing them as root from an ssh session on the remote host
- When things work to your liking, copy the ops code from the
remote
directory back to its location in your project - Test bootstrapping via cloudformation stack deployment
If you want to have an easy way to do this in the future for a particular service....
> export SODEXO_HOST=...
> export SODEXO_KEY=...
> alias sshfs-sodexo='sshfs -o IdentityFile=${SODEXO_KEY} ec2-user@${SODEXO_HOST}:'
> mkdir remote
> sshfs-sodexo remote
> cp -r deploy/* remote
> cd remote
> vim install.sh
# or whatever you want to do.
Assumes you've sshed in and have sudoed to root...
> cat /home/ec2-user/install.sh | bash -l