amazon-web-servicesdockeramazon-ec2amazon-vpcsceptre

How to script AWS VPC with Cloudformation seeded by Docker


I want to confirm my approach to setting up a VPC using cloudformation/scepter and seeding instances with docker container is correct.

  1. Create an aws ec2 instance.
  2. Create a docker image on that instance
  3. Create a cloudformation VPC template (.yaml ) -reference docker image in template?
  4. Create a sceptre project using the template above and run script from ec2 instance

So as I understand if the majority of the work will be in the cloudformation template. Currently I'm stuck on sceptre errors, but I wanted to make sure I was approaching the problem correctly. Does this look like the right approach?


Solution

  • There are a lot of ways of doing what you want:

    1. Run sceptre locally on your development machine
      • This is easier, but not best practice for important environments as having a build server, gives a better trail of what was done when (especially in shared environments)
    2. Use CodeBuild to save you having to do steps 1 & 2 yourself (AWS maintain a docker image with python installed)
      • It also avoids the chicken and egg problem of how you deploy the EC2 instance in the first place.
    3. Configure Jobs on a build server such as Jenkins
      • CodeDeploy is good for simple setups, but a well configured build server, can have dashboards to track what is deployed where
    4. as sceptre is just a way of generating/managing deploying templates across environments, there are lots of other ways of doing this including what you outlined.

    p.s Apologies that the getting started documentation isn't great at the moment, it is something we are focusing on for release 2.0.