Deploying WebApp with AWS VPC using TERRAFORM

Deploying WebApp with AWS VPC using TERRAFORM

AWS Cloud provides Network As A Service(NAAS) through VPC(Virtual Private Cloud).

?A virtual private cloud (VPC) is a virtual network dedicated to your AWS account. It is logically isolated from other virtual networks in the AWS Cloud. You can launch your AWS resources, such as Amazon EC2 instances, into your VPC.

PROBLEM STATEMENT:

We have to create a web portal for our company with all the security as much as possible.So, we use Wordpress software with dedicated database server.Database should not be accessible from the outside world for security purposes.We only need to public the WordPress to clients.

Steps:

1) Write a Infrastructure as code using terraform, which automatically create a VPC.

2) In that VPC we have to create 2 subnets:

  a) public subnet [ Accessible for Public World! ] 

  b) private subnet [ Restricted for Public World! ]

3) Create a public facing internet gateway for connect our VPC/Network to the internet world and attach this gateway to our VPC.

4) Create a routing table for Internet gateway so that instance can connect to outside world, update and associate it with public subnet.

5) Launch an ec2 instance which has Wordpress setup already having the security group allowing port 80 so that our client can connect to our wordpress site.Also attach the key to instance for further login into it.

6) Launch an ec2 instance which has MYSQL setup already with security group allowing port 3306 in private subnet so that our wordpress vm can connect with the same.Also attach the key with the same.

Wordpress instance has to be part of public subnet so that our client can connect our site. 

mysql instance has to be part of private subnet so that outside world can't connect to it.

We write the entire code in vpc.tf file. As soon as we run the command terraform apply the entire architecture will be created.

PROVIDER

We have to mention that we want to use aws provider.

No alt text provided for this image

CREATING VPC

We have to mention ip address range we want for our vpc.

No alt text provided for this image
No alt text provided for this image

CREATING PUBLIC SUBNET

For creating public ip we have to mention that we want public ip .

No alt text provided for this image
No alt text provided for this image

CREATING PRIVATE SUBNET

No alt text provided for this image
No alt text provided for this image

CREATING INTERNET GATEWAY

No alt text provided for this image
No alt text provided for this image

CREATING ROUTE TABLE

No alt text provided for this image
No alt text provided for this image

CONNECTING PUBLIC SUBNET TO ROUTE TABLE

No alt text provided for this image
No alt text provided for this image

CREATING SECURITY GROUP FOR WORDPRESS INSTANCE

This security group allows port no. 80 for wordpress and port no. 22 for ssh to login into the instance.It has ICMP enabled also.

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

LAUNCHING WORDPRESS INSTANCE

No alt text provided for this image
No alt text provided for this image

CREATING SECURITY GROUP FOR MYSQL

No alt text provided for this image
No alt text provided for this image

LAUNCHING MYSQL INSTANCE

No alt text provided for this image
No alt text provided for this image

TERRAFORM APPLY COMMAND

This creates the entire architecture.

No alt text provided for this image
No alt text provided for this image

THANKS FOR READING!!

要查看或添加评论,请登录

Mansi Das的更多文章

  • Deployment Web Application on Kubernetes by Integrating with AWS RDS

    Deployment Web Application on Kubernetes by Integrating with AWS RDS

    Problem Statement 1. Write an Infrastructure as code using terraform, which automatically deploy the WordPress…

  • AUTOMATION USING TERRAFORM-II

    AUTOMATION USING TERRAFORM-II

    TERRAFORM Terraform is an open-source infrastructure as code software tool created by HashiCorp. It enables users to…

    2 条评论
  • VPC with NAT Gateway using Terraform

    VPC with NAT Gateway using Terraform

    AWS Cloud provides Network As A Service(NAAS) through VPC(Virtual Private Cloud). A virtual private cloud (VPC) is a…

    2 条评论
  • AUTOMATION USING TERRAFORM

    AUTOMATION USING TERRAFORM

    TERRAFORM Terraform is an open-source infrastructure as code software tool created by HashiCorp. It enables users to…

  • INTEGRATION OF MACHINE LEARNING WITH DEVOPS

    INTEGRATION OF MACHINE LEARNING WITH DEVOPS

    More than 50% of Machine Learning models are not implemented due to the tedious task of manually training the model…

社区洞察

其他会员也浏览了