How to generate ".env" when Deploying with Bitbucket AWS CodeDeploy add-on?
I see bitbucket-pipelines.yml
can generate .env from bitbucket environment variables, but, how tie it up with Bitbucket AWS CodeDeploy add-on?
appspec.yml
- can trigger script on deployment but how can I make it get .env from bitbucket environment variables?
BitBucket
should not create .env
, this service should know nothing about production .env
. Instead the production .env
should sit on secure AWS S3 bucket
where only AWS CodeDeploy
scripts can take it and put on the instance.
it would be copied like this
sudo aws --region us-east-2 s3 cp "s3://${S3_NAME}/prod.env" "${EC2_DIRECTORY}/.env"