https://github.com/almmiko/aws-previews-deployment
Build AWS Infrastructure for Preview Environments
https://github.com/almmiko/aws-previews-deployment
aws cdktf terraform
Last synced: 6 months ago
JSON representation
Build AWS Infrastructure for Preview Environments
- Host: GitHub
- URL: https://github.com/almmiko/aws-previews-deployment
- Owner: almmiko
- License: mit
- Created: 2022-03-30T07:56:06.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-04-04T17:54:41.000Z (over 3 years ago)
- Last Synced: 2025-04-09T22:52:35.235Z (6 months ago)
- Topics: aws, cdktf, terraform
- Language: JavaScript
- Homepage:
- Size: 342 KB
- Stars: 7
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AWS Infrastructure for Preview Environments  
The AWS infrastructure for showcasing **How to Build Preview Environments for Modern CI/CD Workflows Using Terraform CDK.**
You will deploy [Create React App](https://github.com/facebook/create-react-app), but you can replace the app with any other front-end framework.
The AWS infrastructure is managed using [Terraform Cloud Development Kit](https://www.terraform.io/cdktf).
## Getting Started
Install [terraform CLI](https://learn.hashicorp.com/tutorials/terraform/install-cli).
To install Terraform CDK run:
```bash
npm install --global cdktf-cli@latest
```Create an [AWS profile](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html) with permission to have access to:
- IAM
- S3
- CloudFront
- VPC
- Lambda
- LambdaExecute
- Route53
- CertificateManagerInstall dependencies:
```bash
cd terraform
npm i
```## Configuration
In `terraform/main.ts` file add your configuration:
```js
const configuration = {
BUCKET_NAME: "",
AWS_REGION: "",
AWS_PROFILE: "",
DOMAIN_NAME: "",
WILCARD_DOMAIN_NAME: "",
};
```To build the example app
```bash
cd app
npm i
npm run build
```To upload the example app, replace placeholder values in the `terraform/utils/s3-upload.js` file and run:
```bash
npm run s3:upload
```## Commands
To run deployment plan:
```bash
npm run plan
```To deploy resources:
```bash
npm run deploy
```To synthesize infrastructure configuration:
```bash
npm run synth
```To destroy deployed resources:
```bash
npm run destroy
```> ⚠️ Lambda@Edge can't be destroyed in one run. Wait until AWS removes replicas and re-run destroy command.
## License 
This project is licensed under the MIT License - see the [LICENSE](/LICENSE) file for details.