This repo deploys a dockerized nodejs app using cdk.
It uses ECS fargate and deploys 2 environments - one prod and one staging.
It also sets up a pipeline with a codedeploy job to deploy code to ECR and then trigger a new ECS deployment.
Promotion to prod is manual but you can change that in the pipeline.ts file.
aws ecs update-service --cluster MyApp-Infrastructure-MyAppclusterstagingClusterstagingDDA3CFDA-7wINQdbGlXCQ --service MyApp-Infrastructure-MyAppclusterstagingServicestagingService12E2202D-o7iUxNS5nN0D --force-new-deployment --region us-east-2
This will deploy the original image of your nodejs app, whatever you created the ecs cluster with, if you didn't do it with swolebrain/node-web-app:latest
If you left that unchanged, then the above command will wipe out your application and replace it with my hello world app
- Follow the steps to get started with cdk (installing pre-requisites and boostrapping). You should probably read this whole thing.
- Fork this repo into your github account
- Create a connection from AWS CodeStar to Github or BitBucket (I haven't tested Bitbucket) following (these instructions)[https://docs.aws.amazon.com/dtconsole/latest/userguide/connections-create.html].
- Decide on a name for your app. Let's say you decide to call it KratosService. Put that name in
cdk/configuration.ts
- Choose a region for your service. Choose whatever's closest to you or your customers.
- Create a hosted zone in route 53 for your domain name.
- Take the nameservers from your hosted zone in route53 and go to your domain registrar and override your registrar's nameservers with the ones from route 53. This makes AWS the start of authority over your domain.
- Go to cdk/configuration.ts and update whatever you need to update in there. You have to at least update
ACCOUNT_ID
,HOSTED_ZONE_ID
andHOSTED_ZONE_NAME
. You should consider updatingAPP_NAME
too, and if you didn't end up usingus-east-2
then you need to updateRESOURCE_DEPLOYMENT_REGION
. - Run
cdk deploy
- ????????
- Profit