$ docker compose up$ docker compose exec api npm run migration:runWe need to deploy two stacks - one for sertificate and one for main stack. Sertificate stack is deployed in us-east-1 region, because it is required for Cloudfront distribution. Main stack is deployed in the region you specified at your current aws cli configuration.
# Bootstrap us-east-1 for certificate to use with Cloudfront distribution
cdk bootstrap aws://$(aws sts get-caller-identity --query Account --output text)/us-east-1 --context targetEnv=dev
# Bootstrap your main region (if not done)
cdk bootstrap aws://$(aws sts get-caller-identity --query Account --output text)/$(aws configure get region) --context targetEnv=devThe bootstrap is a one-time setup per region and creates minimal, low-cost infrastructure that CDK needs to operate.
$ npx cdk deploy --all --context targetEnv=devOR if you want to cancel rollback if something went wrong (for debug purposes):
$ npx cdk deploy --all --context targetEnv=dev --no-rollbackaws ssm get-parameter --name "/ec2/keypair/key-07eedf646ad34d126" --with-decryption --query "Parameter.Value" --output text --region eu-central-1 > ~/.ssh/simplenestjs-dev-key.pemSet proper permissions:
chmod 400 ~/.ssh/simplenestjs-dev-key.pemINSTANCE_IP=$(aws ec2 describe-instances --instance-ids i-05783b1bc9b341f7d --region eu-central-1 --query "Reservations[0].Instances[0].PublicIpAddress" --output text)
echo $INSTANCE_IPssh -i ~/.ssh/simplenestjs-dev-key.pem ec2-user@$INSTANCE_IPgather these secrets from your aws console (create access key for user ionicapp-userdeployer)
AWS_ACCESS_KEY_ID=... (access key form console) AWS_SECRET_ACCESS_KEY=... (secret key form console)
gather these variables from cdk output or aws cli
CODE_BUCKET=... (cdk output: ionicapp-devStack.CodeBucketName) EC2_INSTANCE_ID=... (cdk output: ionicapp-devStack.InstanceId) AWS_REGION=... (aws cli command: aws configure get region)