user1736191
user1736191

Reputation: 333

AWS splitting resources between UAT and PROD

I'm using AWS Elastic Beanstalk to deploy a system. That all works fine. If I want a UAT and PROD environment I can just setup 2 different elastic beanstalk apps, this also works fine. Now my question: Say my app uses dynamoDB or S3 buckets (something outside of the EB deployment) how do I have different versions of these for UAT and PROD?

Taking dynamo: you have A dynamo DB instance, not one per EB deployment. My code would write to a 'users' table but how do you stop UAT and PROD using the same user table given there is only one dynamoDB?

Same with S3 buckets? What you ideally want is a prod.mybucket.xxx and uat.my bucket.xxx

I'm clearly missing something, can you tell me what? :)

Upvotes: 0

Views: 1642

Answers (1)

Jon McAuliffe
Jon McAuliffe

Reputation: 3157

You can use Elastic Beanstalk environment variables (this example is for java, but it's similar in other languages). Use one to track the environment type (e.g. PARAM1=dev or PARAM1=uat) then name your other resources (buckets / dynamo tables) with that the prefix

s3 bucket -> prod-myapp-bucket / uat-myapp-bucket

In your code, just grab param1 in bootstrap and bring up your aws resources that way. This is how beanstalk lets your application know which database to connect to (In Java it's JDBC_CONNECTION_STRING).

OR

You could use AWS api to query the actual Elastic Beanstalk environment name to do something similar (depending on what language you're using, it's something like 'Describe Environment').

Upvotes: 0

Related Questions