Giter Club home page Giter Club logo

rproenza86 / aws-infrastructure-code-address_book Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 0.0 8 KB

Terraform infrastructure code for Address Book, a php Web App. Create Virtual Private Cloud, a public and private subnets, an Internet Gateway, a Route Table and add a route to the Internet, a security group for the web server and for the db, deploy web server and a MySQL RDS instance.

HCL 100.00%
aws terraform aws-ec2 aws-vpc aws-subnet aws-internet-gateway aws-route-table aws-security-group aws-rds-mysql private-subnets

aws-infrastructure-code-address_book's Introduction

Address Book Web App infrastructure code

LAMP APP using Amazon Virtual Private Cloud (VPC)

Terraform scripts to build the AWS environment where to deploy and release "Address Book", a LAMP application.

Tested using:

Terraform v0.11.10
+ provider.aws v1.42.0

Infrastructure details

  • Create Virtual Private Cloud(VPC)
  • Create a public and private subnets
  • Create an Internet Gateway
  • Create a Route Table and add a route to the Internet
  • Create a security group for the web server to only allow HTTP inbound traffic from Internet
  • Create a security group for the MySQL RDS instance server to only allow MySQL inbound traffic from the web server subnet
  • Deploy web server and a MySQL RDS instance
  • Configure application to connect to the MySQL RDS instance

How to use

Pre-requirement: Set AWS environment variables

$ export TF_VAR_access_key=<your_key>

$ export TF_VAR_secret_key=<your-secret>

$ export TF_VAR_region=<your_region>

Initialize a working directory

$ cd lamp_intrastructure/

$ terraform init

Create an execution plan

$ terraform plan

Apply the changes required to reach the desired state of the configuration

$ terraform apply

Delete infrastructure

Before to run command delete manually the RDS mysql instance(you will be prompt with securities questions)

$ terraform destroy

How to test?

When applied the configuration terraform will show us the next output:

Outputs:

db_endpoint = terraform-20181102155541101800000001.cfi372mmcqsi.us-east-1.rds.amazonaws.com:3306
web_server_public_ip = 18.209.111.9

Use the db_endpoint and web_server_public_ip for the next steps.

Open the Address Book Web App page

Find on EC2 the "IPv4 Public IP" address(web_server_public_ip) of the "Web Server" instance and open it in a web browser.

Login in the web app and try some CRUD operations

Find the DB endpoint( db_endpoint) on the "Connect" section of the RDS mysql created instance.

Using the DB endpoint and credentials(can be found on the 9-rdsDbResources.tf file) login in the app.

Create, edit or remove contacts to test the web app.

aws-infrastructure-code-address_book's People

Contributors

rproenza86 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.