binchoo / PaimonGanyu

여행 비서 페이몬! Genshin Impact AWS workflows & KakaoTalk chatbot skills
https://pf.kakao.com/_mtPFb
GNU General Public License v3.0
7 stars 1 forks source link

[SAM] Parameterize template.yaml to split prod/stage environments. #8

Closed binchoo closed 2 years ago

binchoo commented 2 years ago

Create a Env parameter

Parameters:
  Env:
    Type: String
    AllowedValues: 
       - prod
       - test

Create a IsProd condition

Conditions:
  IsProd: !Equals
    - !Ref Env
    - prod

Use the !If intrinsic function to configure differently per environment

Resources:
  PaimonGanyuSpringBootApp:
    Type: AWS::Serverless::Function
    Properties:
      …
      ProvisionedConcurrencyConfig:
        ProvisionedConcurrentExecutions: !If [IsProd, 3, 1]
      DeploymentPreference:
        Type: AllAtOnce