- CloudFront URL: https://d1ahyogkj7onzu.cloudfront.net/
- S3 Website URL: https://nodejs-aws-shop-react-438465144658-eu-west-1.s3.eu-west-1.amazonaws.com/ (should return 403 Access Denied)
- Created an S3 bucket and configured it for website hosting.
- Uploaded the MyShop! application manually.
- Configured CloudFront to serve the app securely.
- Invalidated CloudFront cache after making UI changes.
- Created an AWS CDK stack to automate the deployment.
- The stack:
- Creates an S3 bucket.
- Configures a CloudFront distribution with OAI.
- Uses
BucketDeployment
to upload files automatically. - Triggers CloudFront cache invalidation after deployment.
- Verified that
cdk destroy
removes all resources.
Always run bootstrap before the first deployment in a new AWS account/region
-
destroy and cleanup commands will remove AWS resources - use with caution
-
Use diff before deploy to review changes
-
quick-deploy is recommended for development iterations
-
Check doctor if you encounter any issues with deployment
In the project directory, you can run the following npm commands:
-
npm run deploy
- Deploys the CDK stack to AWS without requiring manual approval
- Use this for initial deployment or updating existing resources
-
npm run quick-deploy
- Cleans the build directory and deploys the stack
- Useful when you want to ensure a fresh deployment
-
npm run destroy
- Removes all resources created by the CDK stack
- Use with caution as this will delete all related AWS resources
-
npm run bootstrap
- Initializes the CDK toolkit stack in your AWS account
- Required before first deployment in a new account/region
-
npm run cleanup
- Performs a complete cleanup of all resources and redeploys
- Useful when you need a fresh start
- Executes the following sequence:
- Destroys the application stack
- Removes CDK bootstrap resources
- Cleans local CDK state
- Bootstraps again
- Deploys the stack
-
npm run synth
- Synthesizes CloudFormation templates from your CDK code
- Useful for reviewing what will be deployed
-
npm run diff
- Shows the difference between deployed stack and current code
- Helpful before deploying changes
-
npm run list
- Lists all stacks in the application
- Useful for verifying stack configuration
-
npm run doctor
- Checks your CDK environment for potential issues
- Helpful for troubleshooting
npm run clean
- Removes the CDK build output directory (cdk.out)
- Useful when you want to ensure a clean build
# First-time setup
npm run bootstrap
# Normal deployment flow
npm run deploy
# Check changes before deployment
npm run diff
# Complete reset and redeploy
npm run cleanup
# Remove all resources
npm run destroy