Development Process – Setting Up an AWS Environment Locally

development-environmentdevelopment-process

Currently, our infrastructure sits on AWS (EC2, ElasticBeanstalk, RDS) and consists of a few different services that work together to create our production environment, these consist of a:

  • MySQL server
  • PHP/Apache server
  • few NodeJS servers

Currently for development, it is a real pain to setup a local environment that mimics what we have setup for production. We are using MAMP to setup mysql + apache, but to setup the node servers and configure things locally is quite time consuming.

I'd like to ditch MAMP for a solution that is more similar to the ec2 boxes that each service will run on. I've been looking into setting up docker containers on vagrant, as I think that's the way forward.

My question is: What is the best way to setup a micro-service style architecture for local development using Vagrant + docker (or whatever tool is better) so that the local environment closely matches production?

Best Answer

Vagrant has several provisioning options, including Chef or simply Shell scripts. If you are using one of these techniques to provision your EC2 instances, you should be able to use the same technique to provision your Vagrant started instances.

If, on the other hand, you're setting up your EC2 instances by hand, then you're outta luck.

Note, this assumes you haven't tightly integrated with other AWS services like DynamoDB. If you rely on proprietary AWS services, you may not be able to suitably simulate your production environment.

As to whether you should use one Vagrant instance per microservice or one Vagrant instance for all services, that depends on whether or not your microservices can co-exist. If they can, I'd put them on as few Vagrant instances as possible just to make managing the number of Vagrant instances easier. If, however, they have conflicting requirements (say in Linux versions) I'd go with 1 Vagrant instance per microservice.

Related Topic