Create AWS environment using AWS CDK.
- Use ALB
- Use Fargate on ECS as a container runtime
- Use ECR as a container registry
- Use SSL certification with ACM
- Use parameter store to store credentials
- Use Route53 to set alias of ALB
- awscli
- docker
- Have a AWS Account
- Create a SES Identity
- Have a own domain name
- Already created a certification of ACM
- Create a SendGrid's account
If your profile is not default
, you should execute the below command.
export AWS_PROFILE=[your profile name]
aws ecr get-login-password --region [your region] | docker login --username AWS --password-stdin [your aws account].dkr.ecr.[your region].amazonaws.com
aws ecr create-repository --repository-name [your repository name]
docker build -t [your repository uri]:[tag] .
and push
docker push [your repository uri]:[tag]
Crete .env
file by copying from .env.example
.
And then, fill out the below items.
- deploy
Item | Description |
---|---|
CIDR_BLOCK |
A CIDR block of a new VPC |
VPC_NAME |
A name of a new VPC |
CLUSTER_NAME |
a name of a new ECS cluster |
CLUSTER_IMAGE_REPOSITORY_NAME |
The ECR repository name used by ECS |
CLUSTER_IMAGE_TAG |
A image tag of image used by ECS |
LOAD_BALANCER_DOMAIN_NAME |
The load balancer name to connect |
LOAD_BALANCER_CERTIFICATE_ARN |
The ARN of certification used by ALB |
ROUTE53_DOMAIN_NAME |
The hostzoned name |
- application
Item | Description |
---|---|
APP_GIN_MODE |
The mode of GIN |
APP_MAIL_FROM_ADDRESS |
The from address |
APP_AWS_ACCESS_KEY_ID |
A AWS_ACCESS_KEY_ID used by app |
APP_AWS_SECRET_KEY |
A AWS_SECRET_KEY used by app |
APP_AWS_SES_ENDPOINT |
A AWS_SES_ENDPOINT used by app |
APP_AWS_REGION |
A AWS_REGION used by app |
APP_SENDGRID_API_KEY |
A SENDGRID_API_KEY used by app |
cdk bootstrap
cdk diff
cdk deploy