This repo consist code of terraform by which we can create the AWS resources such as S3, Cloudfront, ec2_instance. Also configuring the Webserver having a simple image url in its html code which is provided by Cloudfront domain name and the object from the S3.
- Create a S3 Bucket.
- Putting an Image as a Object in the S3 bucket.
- Create a Cloud distribution having the below s3 bucket domain name and getting the new Cloudfront domain name.
- Creating an EC2 instance.
- Doing SSH remotly.
- Configuring the instance having httpd install and service started and also enabled lastly copy a demo html code having mainly an image, which we have uploaded in S3 bucket.
- Give the default credentials of the AWS provider in provider.tf file.
- Give your own variable values in the terraform.tfvars file.
- Run "terraform init" command in the terminal.
- Run "terraform plan" cmd.
- Run "terraform apply" cmd.
Lastly it will automatically access the webpage in the chrome browser having the same S3 object but coming from the cloudfront without and delay and secured too.