Automation script for create a Load Balanced Auto Scaling environment for Dockerized PHP and Python webapps.
-
Dependecies: Python
-
First you need to configure the environment in order to run the scripts. You can check how to install Amazon AWS CLI here and configure.
-
When configuring, it's necessary to create an user with permissions to create all the environment and
then provide its AWS Access Key and Secret Access, set the default region name(must match the VPC's and Subnets' region) and the output format to json:
$ aws configure
AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE
AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Default region name [None]: sa-east-1
Default output format [None]: json
1 - Create a VPC with a CDIR block, for example 10.0.0.0/24
2 - Create a Subnet within this VPC, for example 10.0.0.0/24
3 - Create an Internet Gateway and attach in your VPC
4 - Modify the Route Table of you VPC and add a target for your IGW using Destination 0.0.0.0/0
- Later you need to edit two informations on the create_env.sh script. In the header of the file like shown below, change the VPC, Subnet(s) and a key-pair name to match your needs accordingly to the created ones.
#######################################################
# Edit this part to match your needs
#
VPC="vpc-4example"
SUBNETS="subnet-4example"
KEY_PAIR="my-key-pair"
#
#
#######################################################
With all the configuration done, just run the script and wait for the environment finish setting up.
$ chmod +x create_env.sh
$ ./create_env.sh
There is a script to delete the environment, however it doesn't delete the VPC, Subnet and neither the Security Group.
$ chmod +x delete_env.sh
$ ./delete_env.sh