Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rproenza86/aws-infrastructure-code-address_book
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.
https://github.com/rproenza86/aws-infrastructure-code-address_book
aws aws-ec2 aws-internet-gateway aws-rds-mysql aws-route-table aws-security-group aws-subnet aws-vpc lamp private-subnets terraform
Last synced: about 1 month ago
JSON representation
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.
- Host: GitHub
- URL: https://github.com/rproenza86/aws-infrastructure-code-address_book
- Owner: rproenza86
- Created: 2018-11-02T12:43:15.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-11-02T18:10:52.000Z (over 6 years ago)
- Last Synced: 2024-11-06T03:48:31.568Z (3 months ago)
- Topics: aws, aws-ec2, aws-internet-gateway, aws-rds-mysql, aws-route-table, aws-security-group, aws-subnet, aws-vpc, lamp, private-subnets, terraform
- Language: HCL
- Homepage:
- Size: 7.81 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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=$ export TF_VAR_secret_key=
$ export TF_VAR_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.