Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

271
Views
Manage stage and prod environments in AWS SAM/Cloudformation template along with CI/CD support

I'm having an AWS SAM template file with some resources hosted on github, a codepipeline has been setted up to detect changes in the repo then create/update and execute changes on cloudformation stack. Everything is working fine. But now I need to configure stage and prod environments in the same template. I'm finding it difficult how to do it properly.

Different approaches are welcomed as well.

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Are PROD and STAGE in the same account, or different accounts? I will assume same

Transform: AWS::Serverless-2016-10-31

Parameters:
  Environment:
    Type: String
    AllowedValues:
      - STAGE
      - PROD

Resources:
  MyLambda:
    Type: AWS::Serverless::Function
    Properties:
      Handler: lambda_function.lambda_handler
      FunctionName: !Sub ${Environment}_my_lambda
      CodeUri: my_lambda

This would give a unique name to your lambda, by environment

Then when you deploy your template, use --parameter-overrides=Environment=STAGE or --parameter-overrides=Environment=PROD

You can setup CloudWatch to listen to CodeCommit. If STAGE branch changes, call CodeBuild to use the STAGE branch, and call CloudFormation w the STAGE param. Same for PROD

over 4 years ago · Santiago Trujillo Report

0

Parameters would be best

You could also use Mappings or Conditions. But either of those could get messy

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!