This lab walks you through the steps to create a Static website hosted in Amazon S3 Bucket using Terraform.
Duration: 60 minutes
AWS Region: US East (N. Virginia) us-east-1
These are the most basic types of websites and are the easiest to create.
A static web page is a web page that is delivered to the user's web browser exactly as stored.
It holds fixed content, where each page is coded in HTML and displays the same information to every visitor.
No web programming or database design is required when working with them.
They are a safe bet when it comes to security since we do not have any interaction with databases or plugins.
They are reliable, i.e., if an attack happens on the server, a redirection to the nearest safest node happens.
Static websites are very fast because there is no true backend to fetch information from.
Hosting the website is cheap due to the non-existence of any other components.
Scaling the website is easy and can be done by just increasing the bandwidth.
S3 stands for Simple Storage Service.
It provides object storage through a web service interface.
Each object is stored as a file with its metadata included and is given an ID number.
Objects uploaded to S3 are stored in containers called “Buckets”, whose names are globally unique. They organize the Amazon S3 namespace at the highest level.
Amazon S3 creates buckets in the region you specify.
You can assign permissions to these buckets to provide or restrict data transactions.
It is an open-source IaaC (Infrastructure as a code) software tool where you define and create resources using providers in the declarative configuration language example JSON.
With Terraform, You can package and reuse the code in form of modules.
It supports a number of cloud infrastructure providers such as AWS, Azure, GCP, IBM Cloud, OCI, etc.
Terraform has four major commands:
Install Terraform in your local machine using this official guide by Hashicorp.
To install Terraform using CLI, use this guide https://learn.hashicorp.com/tutorials/terraform/install-cli
To install Terraform by downloading, use this guide https://www.terraform.io/downloads.html
Download and Install Visual Studio code editor using this guide https://code.visualstudio.com/download
Launching Lab Environment
Setup Visual Studio Code
Create a variables file
Create an S3 Bucket and its components in main.tf file
Confirm the installation of Terraform by checking the version
Apply terraform configuration
Check the resources in AWS Console
Validation of the lab