Implementing a Solution
Advanced Deployment Techniques
Position and select most appropriate AWS deployment mechanism based on scenario
Demonstrate the ability to design a loosely coupled system
Demonstrate ability to implement the most appropriate front-end scaling architecture
Demonstrate ability to implement the most appropriate middle-tier scaling architecture
Demonstrate ability to implement the most appropriate data storage scaling architecture
Determine trade-offs between vertical and horizontal scaling
In this lesson, we will cover the third and final phase of ACME Printing's move to the cloud. This phase covers the building of a mobile application that will take a series of pictures of an object, upload them for the purpose of generating a 3D model, and provide general account management. Now for starters, we want to use Amazon Cognito. Using Amazon Cognito is a no-brainer for many mobile applications that must integrate with AWS. It's supported on Android and iOS devices, even if we use a development tool like PhoneGap. We could use a standard common API that in turn calls upon the underlying STK libraries. We have many options available to us for deploying and developing our application. The range of features made possible by Amazon Cognito allows us to build quality applications with out-of-the-box manage services. With guest access and data syncing, we can use the mobile application to allow potential customers that do not have an account to request quotes. If the customer approves their quote, then they can be converted from a guest account into a new account without losing any of their data or history. Before we get to the quote phase, we need to be able to handle the processing of images into 3D models. After the images are taken by the customer and uploaded to an S3 bucket, they need to be converted into an acceptable 3D model. This will take a lot of processing power, and our containerized instance alone will not be able to handle it. Instead, we need high-performance EC2 instances. We have many instance families to choose from, most with a specialized purpose, and in this case, we can rely on the G2 instance family to handle the image processing. We will follow base practices by creating an auto-scaling group with a minimum and desired setting of one. This application will be open to all users, meaning not just customers. We will likely experience a high volume of requests as our company brand grows. To determine the max setting, we have to look at our cost tolerance for scaling up. We can offset this cost of using a mix of reserved instances and spot instances. For our purpose, we will set our max value to five. How do we know when to scale up or when to scale back in this scenario? Also, what happens when the number of requests submitted cannot be handled at that moment by the instances we have running? One solution is to use Amazon Simple Queue Service to manage the job queue. Amazon SQS will let us scale up and down based on the queue size. It will also ensure that all jobs submitted will eventually get processed and not just be ignored. Amazon Cognito works well with Simple Queue Service through the API. We upload the pictures and submit the job to Amazon SQS. Our EC2 instances will pick up the job and begin processing it. Upon success, the output from the 3D model will be submitted to our existing workflow. It should go without saying that our EC2 instances will run with the role that is permitted to perform these actions and nothing more. This new application has the potential to be very successful. However, imagine a scenario where we see our app downloaded at a high rate, but only five percent of our users actually submit jobs before quoting. We do not want to be left in the dark about how our users interact with our application. So thankfully, AWS provides a wonderful solution called AWS Mobile Analytics. Now with Mobile Analytics, we can track sessions, number of users, user retention, and more. We can also report on custom events. Our application might track where in the process users have been in the process. This insight can lead us to change the way the user interacts with the application. For example, if users are not getting passed the picture walkthrough of the 3D model, then we can focus on improving that user experience with better messaging or finding ways to reduce the number of required pictures. Another function of our mobile application is to manage an account. We could have our mobile application work through REST APIs directly with our web application, or we could take advantage of API Gateway. With API Gateway, we gain additional services such as caching, versioning, tighter security, monitoring of the API calls, and top performance. If we were using a web application designed without a REST API, we could use the API Gateway as a layer above the application and use lambda functions that could interact with the services we need. We could even throw out our web server completely by implementing our API with lambda functions exposed by HTTP endpoints. The front end of our application could then use a framework like AngularJS, and be hosted on an S3 bucket. Then our web server container could be decommissioned. Does this mobile solution meet our requirements? Most certainly. By using Amazon Cognito, our offline functionality and auto-scaling group to keep our G2 instances running, S3 for image storage and front-end website, SQS for managing the workload, and API Gateway for a highly available service, our application is designed now for higher availability. Security-wise, we limit Amazon Cognito to only the services needed for the mobile application. Our EC2 instances run under a restricted role. Our Amazon API Gateway can take advantage of Cognito authentication and authorization to limit access. And finally, we have chosen low-cost services to run the entire system. The main cost is running the G2 instances to handle our 3D modelling. We can lower that cost with a combination of reserved instances and spot instances that let us control our spend. Okay, so phase three is now complete. In our next session, we'll review how the ACME Printing scenario applies to the AWS Certified Solutions Architect professional certification.
About the Author
Head of Content
Andrew is an AWS certified professional who is passionate about helping others learn how to use and gain benefit from AWS technologies. Andrew has worked for AWS and for AWS technology partners Ooyala and Adobe. His favorite Amazon leadership principle is "Customer Obsession" as everything AWS starts with the customer. Passions around work are cycling and surfing, and having a laugh about the lessons learnt trying to launch two daughters and a few start ups.