Hybrid Multi-Cloud Project
This project is based on the creation of a web server using Terraform, AWS and Github. Projects cover the following points:
- Creation of key and security group which allow the port 80.
- Launching EC2 instance with the key and security group
- Launch one Volume (EBS) and mounting that volume and copying data from GitHub
- Creating an S3 bucket, and storing data from Github into it
- Creating a Cloudfront using s3 bucket (which contains images) and use the Cloudfront URL to update the code
Step 1: Creating a global variable for the key pair and setting up the profile
The profile can be set up by using the command aws configure --profile profile_name and passing the access key and secret key
Step 2: Creating a Security Group which allows port 80 access
Here the Ingress defines the Inbound Rule. We can add as many Ingress as required.
Step 3: Creating an EC2 instance using the key-pair and security group
Here I created an EC2 instance with an AMI image. The EC2 is connected by using a connection attribute with tags type, user, private key, and host. A remote executer enables us to run the commands to install https, git & PHP.
Step 4: Creating an EBS volume | Attach, format and Mount | Clone Github Repo
This step includes creating an EBS volume which takes the availability zone of EC2 automatically. After creation, we link the volume to a folder and this folder is then formatted and mounted to the var/www/html/ folder as httpd takes the content from this folder. Once done, the content from GitHub is cloned into this.
Step 5: S3 bucket creation | cloning static data
Here S3 bucket is created with a unique name. A local executed created a folder in which the git repository is cloned to store the static data. If the infrastructure is destroyed, this folder is also destroyed.
Step 6: Cloudfront creation with S3 bucket data
Cloudfront's domain name is derived from the S3 bucket appended with a domain name tag. A Null Resource helps to connect to the instance and use the Cloudfront URL.
Step 7: Display the IP output and launch the application
Commands to run the file
- terraform init: initializes the folder & downloads the plugins
- terraform validate: validates the program syntax
- terraform apply --auto-approve: runs the program file with default permission
- terraform destroy --auto-approve: destroys the complete infrastructure
Thank you for reaching out!
Early Stage Investing | Theia | JP Morgan I BITS
4 年Congratulations Abhishek !!