This assumes that we have a CoPilot app called test-app
and both a test
& prod
environment configured.
-
Start by uploading environment variables for our application's environments
$ # Test Param $ aws ssm put-parameter \ --name /copilot/apps/test-app/test/dbstring \ --value 'psql://test:[email protected]' \ --type SecureString \ --tags Key=copilot-environment,Value=prod Key=copilot-application,Value=test-app $ # Prod Param $ aws ssm put-parameter \ --name /copilot/apps/test-app/prod/dbstring \ --value 'psql://prod:[email protected]' \ --type SecureString \ --tags Key=copilot-environment,Value=prod Key=copilot-application,Value=test-app
-
Update the
manifest.yaml
to useenvironment
which overrides per environment
secrets:
DB_STRING: /copilot/apps/test-app/test/dbstring
environments:
prod:
secrets:
DB_STRING: /copilot/apps/test-app/prod/dbstring
Here the default is to use the test variable but when deploying to prod it specifically uses a production variable.
Thank you! ๐ (Why this is not in docs of Copilot ๐ )