This is an AWS CDK project for setting up the AWS infrastructure needed to run my Expense Tracker app. The infrastructure includes:
- the storage bucket for storing the images,
- the CDN for caching uploaded images, and
- the function for invalidating the CDN cache.
Clone this repository.
$ git clone https://github.com/arvl130/expense-tracker-infra.git
$ cd expense-tracker-infra
Install the project dependencies.
$ npm install
By default, this project will use your default AWS account/region to deploy the CloudFormation stack. To configure a default AWS account/region on your computer, you may use the AWS CLI.
$ aws configure
Bootstrap CDK on your AWS account if you have not done so already.
$ npm run cdk bootstrap
Run the following command to deploy the stack. This may take a few minutes.
$ npm run cdk deploy
Once the stack has been deployed, you may run the following command to see your CloudFront distributions.
$ aws cloudfront list-distributions
Find the distribution created by the stack, and save the distribution domain name. You may now use this domain for serving images in the Expense Tracker app.
Run the following command to see your S3 buckets.
$ aws s3 ls
Find the storage bucket created by the stack, and save the bucket name. Likewise, you now may use this bucket for the Expense Tracker app.
npm run build
compile typescript to jsnpm run watch
watch for changes and compilenpm run test
perform the jest unit testsnpm run cdk deploy
deploy the stack to your default AWS account/regionnpm run cdk destroy
remove the stack from your default AWS account/regionnpm run cdk diff
compare deployed stack with current statenpm run cdk synth
emits the synthesized CloudFormation template