With the idea of showing off my skills, I have created a repository to list all of the ways I have designed infrastructures that run my portfolio using different IaC and cloud resources.
You can find that repository here: https://github.com/christian-deleon/portfolio-iac
The front end was designed and developed by me using React.Js, Javascript, HTML, and CSS.
Frontend Repository: https://github.com/christian-deleon/portfolio
Using AWS CDK ( Cloud Development Kit ) with AWS ECS Fargate running the web servers, I have created an application which uses Docker
to containerize the Node.Js
server and consists of the following AWS resources:
AWS ECS
( Elastic Container Service ) as the container service for the web serversAWS Route 53
for the domain name services and creates a hosted zone in each AWS region that has been specifiedAWS Certificate Manager
which provides the SSL certificate for secure connection from the client to the load balancersAWS ELB
( Elastic Load Balancing ) which balance all HTTPS to the web serversAWS ASG
( Auto Scaling Groups ) which auto scales the Fargate web servers running on ECS based on CPU usageAWS CodePipeline
for the CI/CD ( Continuous Integration and Continuous Delivery )AWS CodeBuild
which takes changes from the respective GitHub repository and builds the React application image using Docker and updates or stores it inAWS ECR
AWS Lambda
that updates the AWS ECS cluster service with the updated Docker image from ECRAWS EventBridge
which triggers the above Lambda function when a successful push has been made to the main region ECR repository
-
aws configure
-
cdk bootstrap
Skip this section if you do not wish to use your own domain name.
If you would like to purchase your own domain name through AWS Route53 follow this official AWS Guide.
-
If you do not already have a hosted zone in Route53 (AWS Guide)
- Go to Route53
- If you're new to Route 53, choose Get started under DNS management.
- If you're already using Route 53, choose
Hosted zones
in the navigation pane. - Choose
Create hosted zone
. - In the Create Hosted Zone pane, enter the name of the domain that you want to route traffic for. You can also optionally enter a comment.
- For Type, accept the default value of Public Hosted Zone.
- Choose
Create
.
-
Update domain name servers (AWS Guide)
- Go to Route53
- In the navigation pane, choose
Registered Domains
. - Choose the name of the domain for which you want to edit settings.
- Choose
Add or edit name servers
. - Replace the name servers with the name servers for the Route 53 hosted zone.
-
Change directory to the architecture of your choice.
-
Configure your infrastructure with the
config.yaml
file.For the ECS CPU and Memory configuration
-
Synthesize the CloudFormation Templates:
cdk synth
-
Deploy the GitHubConnection stack to connect your account to Github:
cdk deploy GitHubConnection
-
Wait the stack to finish before continuing.
-
Accepting the GitHub connection
- Go to AWS CodeStar Connections.
- Choose the
github-portfolio-connection-ecs
connection. - Click
Update pending connection
.
-
Deploy the PersistentParentStack and PipelineStackECS stacks:
cdk deploy PersistentParentStack PipelineStack
-
Go to the AWS CodePipeline Console and wait for the
PipelineStackECS
pipeline to finish. -
Deploy the remaining stacks:
cdk deploy --all
-
Update the
config.yaml
ecs values. -
Re-deploy stacks:
cdk deploy --all
If you want to destroy the stacks simply run:
cdk destroy --all --force