Skip to content

ZhengPei1/Cloud-Portfolio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

My Cloud Portfolio


πŸ—οΈ Architecture

Component AWS Service
DNS & CDN Route 53, CloudFront
Frontend HTML, CSS, JavaScript
Backend API API Gateway, AWS Lambda (Python)
Data Storage DynamoDB
Static Hosting S3
IaC Terraform

πŸš€ Deployment Guide

This guide assumes you have the AWS CLI configured and Terraform installed locally.

Prerequisites

  • An AWS account with appropriate permissions.
  • Terraform installed locally.
  • AWS CLI configured with your access keys (or IAM role for assumed access).

Step 1:

Create the necessary variables file for your deployment.

  1. Navigate to the ./terraform/ directory.
  2. Create the file terraform.tfvars.
  3. Populate this file using the structure provided in ./terraform/exampletfvars.txt.

Step 2:

⚠️ WARNING ON COST: Be aware that the Route 53 resource will register a new domain name, which incurs an immediate annual registration fee. If you already own a domain, update the Terraform code to import your existing domain or skip the Route 53 resource creation before proceeding.

Navigate to the Terraform directory and execute the following commands:

cd terraform
terraform init
terraform plan
terraform apply

Terraform Output

api_endpoint # use this to set up your config.js file in step 3

cloudfront_domain_name

website_url

Step 3:

  1. Navigate to the ./webpage directory.
  2. Create a file named config.js and add the following line
const API_ENDPOINT = "YOUR_API_ENDPOINT_FROM_TERRAFORM";

Note: You may need to invalidate the Cloudfront Cache if you want to see your webpage update immediately

πŸ“ Repository Structure

  • lambda/: Contains the Python code and necessary dependencies for the AWS Lambda function(s).
  • terraform/: Contains all Infrastructure as Code (IaC) files:
    • backend.tf: Defines the API Gateway and Lambda setup.
    • database.tf: Defines the DynamoDB table structure.
    • DNS.tf: Defines the Route 53 domain and CloudFront distribution.
    • main.tf: Provider specifications, variable declarations.
    • output.tf: Defines the variables printed after deployment.
    • storage.tf: Defines the S3 bucket configuration for static website hosting.
    • terraform.tfvars: (Not included) Your private variable values.
  • webpage/: Contains the static files (HTML, CSS, JavaScript) that constitute the frontend portfolio website.

About

zheng-pei.com

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published