Rosalie_Baxter
Rosalie_Baxter

Reputation: 23

Deploying a staging site to AWS

Hi: looking to deploy a staging site to AWS. Production is a Rails app on an EC2 instance linked to an RDS database on a MYSQL Engine, with Nginx / Phusion Passenger as web server.Currently deploy via github.

Current plan looks roughly like: 1. screenshot the AMI of my existing server and create a new EC2 instance copying it. 2. Also copy the RDS and the S2? (?) 3. Add in some env variables to the github code so it connects to the correct database when staging vs production 4. Try and deploy the code to the new test site

Does this sound about right? Can anyone offer any good guidance who has done this before?

I saw a lot about separate AWS accounts - is this necessary for a v small development team (i.e. only me and occasional freelancers)?

Upvotes: 0

Views: 731

Answers (1)

Tom Nijs
Tom Nijs

Reputation: 3962

Separate AWS accounts is a best practice (when the architecture merits it). A secondary solution could be having it in separate regions and tertiary solution would be just a to have it in the same region but at least a separate VPC, obviously losing some security benefits each time.

In terms of getting it set up - since you haven't mentioned network connectivity - I'm hoping you omitted that for brevity but it's definitely worthwhile to set up a VPC with private subnets to host your database and only allow your EC2 instance to communicate to the RDS instance directly. Having a database publicly available over the internet is a no-no. (details)

As for your stack (you have it covered) - take a backup of your EC2/RDS (image,rds snapshot) - copy them across region/account if need be and spin up the clones. Make the code aware of which environment it runs in and determine the endpoints based on that. You didn't provide much details on the nginx side of things but if that's an EC2 as well, rinse and repeat.

PS: If you think you might be doing this more often, consider creating a CloudFormation stack outlining your environment so that, if need be, you can just create another stack which'll spin up a new environment for you.

Good luck!

Upvotes: 1

Related Questions