Mini-Project 2 (mp2)
Objectivesh
Implement and demonstrate of creating and deploying 3 tier cloud native web-apps
Understand and implement Cloud native techniques such as Auto-Scaling, Cloud based Databases, queuing systems, and notification systems, Lambda functions.
Outcomes
At the conclusion of this assignment you will have completed a survey of basic cloud-native development techniques and have successfully converted a single tier web app into a 3-tier cloud native applicationwith a repeatable infrastructure.
Requirements
Application:
This project requires builds upon the previous project.You can reuse your project code as you deem necessary.Create a separate folder under your GitHub repo and class folder and name it mp2.
Web application will include 4 pages, (pulled from your GitHub account)
index page
With the previous form, index.php, collect 3 items, name, email, and phone number as well as a submit button to post an image for processing and insert proper data into your Amazon DynamoDB instance. We are removing the RDS service.
See Database Schema below and create the same schema (Attributes) in Amazon DynamoDB
gallery page
reads your database and retrieves all of the before and after pictures using select * match the email ID
You can use any language you want (the sample is simple PHP)
You will need to access your database via the AWS language SDK of your choice
http://docs.aws.amazon.com/aws-sdk-php/v3/guide/getting-started/installation.html
http://docs.aws.amazon.com/aws-sdk-php/v3/api/
http://docs.aws.amazon.com/aws-sdk-php/v3/api/class-Aws.Rds.RdsClient.html
submit page (form data is posted to this page not user facing)
upon submission of the form, images are placed in the proper S3 bucket, and a URL and information relating to that job is entered into the DynamoDB table.
Update the database record accordingly
Place a message on the queue indicating the UUID of the just created record for the process to retrieve.
Process method
Graduates will create a Lambda Function, upon image upload will trigger and SNS notification to the Lambda Function code which will be used to process the image, store it in the finished S3 bucket and update the DynamoDB table.https://aws.amazon.com/lambda/
Undergrads will create a sperate EC2 instance, that runs code as a Cron job or an infinite loop that will:
Query the SQS queue looking for new work
Will retrieve the message body containing the UUID of the job in progress
Retrieve the image in question, process this image (create thumbnail or create black and white image)
Upload the rendered image to the S3-finished bucket
Update the DynamoDB record in question fields
Post a message the SNS subscription topic including the S3 URL to the finished image
Delete the message from the queue
Database Schema DynamoDB Attributes (Schema)
Aws dynamodb create-table table-name Records attribute-definitions AttributeName=UUID,AttributeType=S AttributeName=email,AttributeType=S AttributeName=phone,AttributeType=S AttributeName=filename,AttributeType=S AttributeName=s3rawurl,AttributeType=S AttributeName=s3finishedurl,AttributeType=S AttributeName=status,AttributeType=N AttributeName=issubscribed,AttributeType=B key-schema AttributeName=uuid,KeyType=HASH
uuid stringemail stringphone stringfilename string s3rawurl strings3finishedurl stringstatus numberissubscribed boolean
aws dynamodb create-table table-name RecordsXYZ attribute-definitions AttributeName=Receipt,AttributeType=S AttributeName=Email,AttributeType=S key-schema AttributeName=Receipt,KeyType=HASH AttributeName=Email,KeyType=RANGE provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5
Receipt stringEmail stringPhone stringFilename string S3rawurl stringS3finishedurl stringStatus number booleanIssubscribed boolean
Infrastructure
Create a load-balancer
Create a launch configuration to deploy your custom images
Taking the positional parameters given from the command-line and defined in the previous assignment
Create an autoscaling group that launches the following instances
Count of 3 is desired
Count of 2 is minimum
Count of 4 is maximum
Attach load-balancer to auto-scaling group
Create a standalone EC2 instance for image processing and queue updating
Create an DynamoDB table with attributes defined above
Create an SQS message queue
Create an SMS subscription topic
S3 Bucket for storing before (pre-processing)Assume this is created ahead of time and the URI is known
S3 Bucket for storing after (post-processing) Assume this is created ahead of time and the URI is known
Variables
Variables needed to launch on my own account must be passed by positional parameters and details mentioned in the ReadMe.md
Deliverables
Locate all resources in a folder in your GitHub repo named: mp2 (note the spaces and spelling)
create-env.sh
creates all AWS infrastructure needed
install-app-env-front-end.sh
Deploys the front end of your source code, index.php, submit.php, gallery.php, of your source code and installs any dependencies/creates tables
Create your own custom AMI with GitHub code-deploy key already in place and give access to this user ID 5480-0215-1864 (mine) via the AWS console.
Install-app-env-back-end.sh
Move the code for image processing here
Use the same custom AMI you created for step 2
Create an additional file, process.php, that will run as as service or in a loop to process the following:
Read the Queue for new jobs
Retrieve and Modify the image
Update the DynamoDB table
Remove the Queue message
Place the rendered image in the finished bucket
Send the SMS text message to notify the user the image is done
destroy-env.sh script to delete all of the resources previously created
This does NOT include S3 buckets
***Note for this assignment assume that your security group and key-pairs are already pre-existing
Positional Parameters
$1 will be Image ID$2 will be count$3 will be Instance Type$4 will be KeyPair Name$5 will be Security Group ID$6 will be IAM profile/Role$7 will be subnet Id$8 IAM Lambda role ARN
Example location YOUR ARN WILL BE DIFFEREN
Documentation
Create a readme.md file inside the folder called midterm in your class GitHub repo. Include the needed shell scripts and in the readme.md give an explanation and example of what will/should happen
Grading Rubric
It has to work! So test, test, test it.
Undergraduates 100 points total
45 points per deliverable 1
10 points for Proper installation and Configuration of Load Balancer
10 points for creating DynamoDB table
10 points for creating S3 buckets
10 points for using positional parameters in script deployment
5 points for naming the shell script correctly according to this document
45 points per deliverable 2
10 points for properly working index page
10 points for properly working gallery page
10 points for properly working submit page
10 points properly working process page/script and sperate AMI
5 points for properly named shell script according to this document
10 points per deliverable 3
10 points if it destroys everything created(S3 buckets not included)
Graduates 100 points total
45 points per deliverable 1
10 points for Proper installation and Configuration of Load Balancer
10 points for creating DynamoDB table
10 points for creating S3 buckets
10 points for using positional parameters in script deployment
5 points for naming the shell script correctly according to this document
45 points per deliverable 2
10 points for properly working index page
10 points for properly working gallery page
10 points for properly working submit page
10 points for properly working Lambda function
5 points for properly named shell script according to this document
10 points per deliverable 3
10 points if it destroys everything created (S3 buckets not included)
Reviews
There are no reviews yet.