Skip to content

Latest commit

 

History

History
143 lines (96 loc) · 2.31 KB

DEPLOYMENT.md

File metadata and controls

143 lines (96 loc) · 2.31 KB

Stack CI pipeline deployment

1. Preconditions

npm install -g np@latest
npm install -g aws-cdk@latest
cdk --version

Output:

2.16.0 (build 4c77925)

2. Install dependencies and test project

npm install
npm run test

3. Update stack config (if necessary)

Update stack props in stack/synth.ts and commit

4. Create CodeCommit repository (if CI is necessary)

For consistence use CammelCase naming convention

APP_NAME=MyAppCamelCaseName

APP_DESCRIPTION="App description"
aws codecommit create-repository --repository-name ${APP_NAME}Stack --repository-description $APP_DESCRIPTION --profile default

command output:

{
  "repositoryMetadata": {
    ...
    "cloneUrlSsh": "ssh://git-codecommit.eu-west-1.amazonaws.com/v1/repos/NewOrderProductAppendStack",
    ...
  }
}

Ensure you have valid ssh config for CodeCommit.

REPO_CLONE_URL=[cloneUrlSsh]

Replace host (git-codecommit.eu-west-1.amazonaws.com) in cloneUrlSsh to alias, if necessary.

Add origin

git remote add origin $REPO_CLONE_URL

Add stage branch

git branch stage

Commit all current changes.

Push to master

git push --set-upstream origin master

Push to stage

git push origin stage

5. Bootstrap AWS account (if necessary)

Once for each deploy region in current account,

npx cdk bootstrap --cloudformation-execution-policies arn:aws:iam::aws:policy/AdministratorAccess --profile default

or specific account

npx cdk bootstrap aws://ACCOUNT-NUMBER/REGION --cloudformation-execution-policies arn:aws:iam::aws:policy/AdministratorAccess --profile default

Get current ACCOUNT-NUMBER

aws sts get-caller-identity
aws sts get-caller-identity --profile default

Get current REGION

aws configure get region
aws configure get region --profile prod

6. Release new version (if necessary)

np

7. Setup environment

Ensure all configs and secrets described in README is existsy.

8. Deploy CDK stack

PROFILE=default npm run deploy