Hey everyone! We've grown our team to around 50 people working on an AWS-hosted product initially developed by a small group. We're facing challenges with multiple developers altering infrastructure at the same time. Currently, our workaround is that one person will announce they're using an environment on Slack, and everyone else has to wait for them to finish, which can be pretty inefficient.
We're utilizing CloudFormation for our infrastructure deployment, and I've been wondering if it's feasible to deploy separate infrastructure based on branch names or commit hashes. For example, if I'm developing feature 1, I could have `S3 bucket-feature-1`, `RDS rds-feature-1`, and so on, while my teammate works on feature 2 with `S3 bucket-feature-2`, etc. This setup could help us work independently without overwriting each other's changes. Is this possible with CloudFormation templates? What are the best practices to handle infrastructure in a parallel development environment? Thanks!
4 Answers
You might want to consider using ephemeral environments as another solution. This could help manage resources better and ensure that you're not stepping on each other's toes. Check out this article for more details: https://theburningmonk.com/2023/02/how-to-handle-serverful-resources-when-using-ephemeral-environments/
Absolutely, CloudFormation can simplify this for you. You just need to create different stacks with unique names, like `appA-branchX`, `appA-branchY`, etc. Remember to use CloudFormation's automatic resource naming; it allows you to create multiple stacks without conflicts. If you're specifying individual names, make sure to pass those in as variables for things like IAM roles or security groups. This way, everything stays organized and you can clean up easily once you’re done testing!
You're on the right path since you're already using Infrastructure as Code (IaC). Just ensure your CloudFormation templates are parameterized so you can pass in names specific to each environment. For instance, append the branch or feature name to your resource names. If you switch to the AWS CDK, it’ll make naming easier with a helper function that generates these names. Plus, update your CI/CD pipeline to deploy infrastructure on GitHub events, and it can automatically tear down resources when a feature branch is merged! Let me know if you want to explore some third-party tools that might help with this too!
I suggest setting up your CI/CD pipeline to manage changes more effectively. Perhaps dedicate branches for each environment: every commit can deploy to development, followed by testing in QA through pull requests, and then to production once verified. Utilize AWS Parameter Store and pipeline variables to manage environment specifics within a single template, naming each resource based on the environment. For example, a resource could be referred to as `MyAppStack-dev`. Happy to provide examples if you need them!
Related Questions
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically
[Centos] Delete All Files And Folders That Contain a String