https://github.com/devenes/cloudformation-loadbalancer-phonebook
The Phonebook Application aims to create a phonebook application in Python and deployed as a web application with Flask on AWS Application Load Balancer with Auto Scaling Group of Elastic Compute Cloud (EC2) Instances and Relational Database Service (RDS) using AWS CloudFormation Service.
https://github.com/devenes/cloudformation-loadbalancer-phonebook
alb-listener alb-target-group application-load-balancer auto-scaling aws aws-application-load-balancer aws-ec2-launch-templates cloudformation ec2 flask mysql python rds relational-database-service security-groups sql
Last synced: 4 months ago
JSON representation
The Phonebook Application aims to create a phonebook application in Python and deployed as a web application with Flask on AWS Application Load Balancer with Auto Scaling Group of Elastic Compute Cloud (EC2) Instances and Relational Database Service (RDS) using AWS CloudFormation Service.
- Host: GitHub
- URL: https://github.com/devenes/cloudformation-loadbalancer-phonebook
- Owner: devenes
- License: mit
- Created: 2022-04-25T11:57:12.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-04-25T21:20:44.000Z (about 3 years ago)
- Last Synced: 2025-01-03T15:44:22.731Z (5 months ago)
- Topics: alb-listener, alb-target-group, application-load-balancer, auto-scaling, aws, aws-application-load-balancer, aws-ec2-launch-templates, cloudformation, ec2, flask, mysql, python, rds, relational-database-service, security-groups, sql
- Language: Python
- Homepage:
- Size: 565 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Python Flask Phonebook Application deployed on AWS Application Load Balancer with Auto Scaling and Relational Database Service using AWS CloudFormation
## Description
The Phonebook Application aims to create a phonebook application in Python and deployed as a web application with Flask on AWS Application Load Balancer with Auto Scaling Group of Elastic Compute Cloud (EC2) Instances and Relational Database Service (RDS) using AWS CloudFormation Service.
## Project Details

## CloudFormation Stack

- Your company has recently started a project that aims to serve as phonebook web application. You and your colleagues have started to work on the project. Your teammates have developed the UI part the project as shown in the template folder and they need your help to develop the coding part and deploying the app in development environment.
- As a first step, developer gives you this program that creates a phonebook, adds requested contacts to the phonebook, finds and removes the contacts from the phonebook.
- Application allows users to search, add, update and delete the phonebook records and the phonebook records is kept in separate MySQL database in AWS RDS service. Following is the format of data to be kept in db.
- id: unique identifier for the phone record, type is numeric.
- person: full name of person for the phone record, type is string.
- number: phone number of the person. type is numeric.
- All the interactions with user on phonebook app are done in case insensitive manner and name of the person is formatted so that, only the first letters of each words in the name of the person is in capital letters. If the user inputs number in the username field, user is warned with text message.
- Phone numbers in the app can be in any format, but the inputs are checked to prevent string type. If the user inputs string in the number field, user is warned with text message.
- Example for user inputs and respective formats
```text
Input in username field Format to convert
-------------- -----------------
'' Warning -> 'Invalid input: Name can not be empty'
callahan Callahan
joHn doE John Doe
62267 Warning -> 'Invalid input: Name of person should be text'Input in number field Format to convert
-------------- -----------------
'' Warning -> 'Invalid input: Phone number can not be empty'
1234567890 1234567890
546347 546347
thousand Warning -> 'Invalid input: Phone number should be in numeric format'
```- As a second step, you are requested to deploy your web application using Python's Flask framework.
- This app is transformed into web application using the `index.html`, `add-update.html` and `delete.html` within the `templates` folder. Note the followings for your web application.
- User should face first with `index.html` when web app started and th user should be able to;
- search the phonebook using `index.html`.
- add or update a record using `add-update.html`.
- delete a record using `delete.html`.
- User input can be either integer or string, thus the input should be checked for the followings,
- The input for name should be string, and input for the phone number should be decimal number.
- When adding, updating or deleting a record, inputs can not be empty.
- If the input is not conforming with any conditions above, user should be warned using the `index.html` with template formatting.
- The Web Application should be accessible via web browser from anywhere.
- Lastly, you are requested to push this program to the project repository on the Github and deploy your solution in the development environment on AWS Cloud using AWS CloudFormation Service to showcase your project. In the development environment, you can configure your CloudFormation template using the followings,
- The application stack should be created with new AWS resources.
- Template should create Application Load Balancer with Auto Scaling Group of Amazon Linux 2 EC2 Instances within default VPC.
- Application Load Balancer should be placed within a security group which allows HTTP (80) connections from anywhere.
- EC2 instances should be placed within a different security group which allows HTTP (80) connections only from the security group of Application Load Balancer.
- The Auto Scaling Group should use a Launch Template in order to launch instances needed and should be configured to;
- use all Availability Zones.
- set desired capacity of instances to `2`
- set minimum size of instances to `1`
- set maximum size of instances to `3`
- set health check grace period to `90 seconds`
- set health check type to `ELB`
- The Launch Template should be configured to;
- prepare Python Flask environment on EC2 instance,
- download the Phonebook Application code from Github repository,
- deploy the application on Flask Server.
- EC2 Instances type can be configured as `t2.micro`.
- Instance launched by CloudFormation should be tagged `Web Server of StackName`
- For RDS Database Instance;
- Instance type can be configured as `db.t2.micro`
- Database engine can be `MySQL` with version of `8.0.19`.
- Phonebook Application Website URL should be given as output by CloudFormation Service, after the stack created.
## Expected Outcomes
- Phonebook App Search Page
.png>)
- Phonebook App Add/Update Page
.png>)
### At the end of the project, following topics are to be covered;
- Programming with Python
- Programming with SQL
- Web application programming with Python Flask Framework
- MySQL Database Configuration
- Bash scripting
- AWS EC2 Launch Template Configuration
- AWS EC2 Application Load Balancer Configuration
- AWS EC2 ALB Target Group Configuration
- AWS EC2 ALB Listener Configuration
- AWS EC2 Auto Scaling Group Configuration
- AWS Relational Database Service Configuration
- AWS EC2 Security Groups Configuration
- AWS CloudFormation Service
- AWS CloudFormation Template Design
- Git & Github for Version Control System
### At the end of the project, you will be able to;
- configure connection to the `MySQL` database.
- work with a database using the SQL within Flask application.
- demonstrate bash scripting skills using `user data` section within launch template in CloudFormation to install and setup web application on EC2 Instance.
- demonstrate their configuration skills of AWS EC2 Launch Templates, Application Load Balancer, ALB Target Group, ALB Listener, Auto Scaling Group, RDS and Security Groups.
- configure CloudFormation template to use AWS Resources.
- show how to use AWS CloudFormation Service to launch stacks.
- apply git commands (push, pull, commit, add etc.) and Github as Version Control System.
## Resources
- [Python Flask Framework](https://flask.palletsprojects.com/en/1.1.x/quickstart/)
- [Python Flask Example](https://realpython.com/flask-by-example-part-1-project-setup/)
- [AWS CloudFormation User Guide](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Welcome.html)
- [AWS CLI Command Reference](https://docs.aws.amazon.com/cli/latest/index.html)