VC house for the site: rajkumar.app
- Install npm
- Use the command
npm create vite@latest
to create the template - Enter Project Name, Choose Vanilla framework and javascript variant in the next options
- Go into the project and use the command
npm install
- Install ThreeJS by using
npm install three
- Use
npm run dev
to initialize server and see a counter app by default - Use CTRL+C to terminate server
- Create an AWS account
- Create an IAM user and attach AdministratorAccess directly
- Once the user is created, create an access key for that user to use AWS CLI and download the one-time CSV
[If you forget to download or save the key, perform same step again to get a new key association] - Run the command
aws configure
and supply it with necessary details for the AWS account
[Access key ID (from csv), Secret key (from csv), region (us-east-2), output format(json)] - Go to 'https://console.aws.amazon.com/codesuite/settings/connections', create a connection for GitHub and follow through process for new application
[Login to your GitHub, choose just the repo and make sure proper access is given in GitHub.
Once done, get the ARN value for this connection and replace this value in tfvars variable: github_connection_arn]
- Download Terraform, preferably v1.5 or better
- Set the path to the download location of the exe file in system/environment variables
- Go to scripts/aws and make necessary adjustments in tfvars file to match the needs
[Also adjust codedeploy agent install script with proper region and start server script with proper site/cert details] - From scripts/aws, initialize terraform using
terraform init
[Useterraform init -upgrade
in case of any changes next time] - From same location, check resource creations / validations using
terraform plan -var-file varfile.tfvars
- From scripts/aws, create all resources using
terraform apply -var-file varfile.tfvars
- Once finished, go to AWS console and verify all resources
- Verify if key files (.pem and .pub) are present in specified path
- From any local terminal, check connection to ec2 instance using the command:
ssh -i "<location-to-keypairfile>/<filename>.pem" ec2-user@<public-ipv4-dns-of-ec2-instance>
- Go to the public ip address (only http, not https) to check the website rendered
- To destroy all resources, use
terraform destroy -var-file varfile.tfvars
- To plan, apply or destroy only a particular resource, use the flag
terraform <command> -target=<res-type>.<res-name> -var-file varfile.tfvars
- Once all resources are created, login to ec2 instance using the command:
ssh -i "<location-to-keypairfile>/<filename>.pem" ec2-user@<public-ipv4-dns-of-ec2-instance>
- Simultaneously, go to "https://domains.google.com/registrar/\<your-site>/security" and then onto "SSL/TLS certificates for your domain" -> "Google Trust Services" -> "Get EAB Key" to get both EAB & HMAC keys.
- Fill in the values in below command and run it on the terminal from Step 1:
sudo certbot register --email <registered-email-for-site> --no-eff-email --server "https://dv.acme-v02.api.pki.goog/directory" --eab-kid "<eab-id>" --eab-hmac-key "<hmac>"
Type 'Y' to accept terms and register the account.
[Note: Generated keys are one-time use and expires in 7 days] - Link your public IP v4 address of ec2 instance to the DNS of your site: "https://domains.google.com/registrar/\<your-site>/dns"
[Fill in hostname(sitename), Type(A), TTL(5mins), Data(IPv4 address)] - In your ec2 intance, use
sudo killall http-server
to kill any existing connections. - Generate the initial certificate using command:
sudo certbot certonly -d <your-site> --server "https://dv.acme-v02.api.pki.goog/directory" --standalone
[Generated certificate is valid for 3 months. It is usually a good process to renew certificate (Use command:sudo certbot renew -q
) within that duration using a cron job to avoid generating certificates again] - Either do a dummy commit to trigger CI/CD, or use the CodePipeline from AWS console to release change.