Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lauravuo/aws-spa
CDK script for deploying single-page-app to AWS S3
https://github.com/lauravuo/aws-spa
aws aws-acm aws-cdk cloudfront deployment devops https route53 s3 s3-website single-page-app spa
Last synced: 24 days ago
JSON representation
CDK script for deploying single-page-app to AWS S3
- Host: GitHub
- URL: https://github.com/lauravuo/aws-spa
- Owner: lauravuo
- License: apache-2.0
- Created: 2020-05-11T15:05:12.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T14:58:47.000Z (about 2 years ago)
- Last Synced: 2024-11-14T06:32:15.601Z (3 months ago)
- Topics: aws, aws-acm, aws-cdk, cloudfront, deployment, devops, https, route53, s3, s3-website, single-page-app, spa
- Language: TypeScript
- Homepage:
- Size: 1.47 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 18
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SPA deployment to AWS
Instructions with CDK script for deploying single-page-app to S3.
After executing manual steps from section **prerequisities** you can run the CDK script. The script will create- S3 bucket for storing the files
- TLS certificate to region "us-east-1" via ACM
- Cloudfront distribution with the TLS certificate for the S3 bucket
- Route53 record in a pre-existing hosted zone for the cloudfront distribution
- IAM user with S3 bucket update permissions for CI use## Prerequisities
1. Make sure you have installed node.js, AWS CDK and Typescript:
```bash
# node
nvm install# aws cdk
npm install -g aws-cdk# typescript
npm install -g typescript
```1. You need AWS Account. [Create IAM user and AWS Access keys via console](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html) if you don't have one already.
1. [Create a public hosted zone to AWS Route53](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/CreatingHostedZone.html) for your domain. If your domain registrar is different from AWS Route53, you need to store the AWS nameservers to your domain settings (via the domain registrar UI).
1. Declare following environment variables:
```bash
# default region for AWS e.g. eu-north-1
export AWS_DEFAULT_REGION=# IAM user access key ID
export AWS_ACCESS_KEY_ID=# IAM user secret access key
export AWS_SECRET_ACCESS_KEY=# default region for AWS e.g. eu-north-1
export CDK_DEFAULT_REGION=# AWS account number
export CDK_DEFAULT_ACCOUNT=
```## Steps
```bash
# install deps
npm install# bootstrap CDK
cdk bootstrap# deploy CDK
cdk deploy
```