Troubleshooting Serverless Applications
Self-Paced Lab 250
© 2020 Amazon Web Services, Inc. and its affiliates. All rights reserved. This work may not be reproduced or redistributed, in whole or in part, without prior written permission from Amazon Web Services, Inc. Commercial copying, lending, or selling is prohibited.
Errors or corrections? Email us at email@example.com.
Other questions? Contact us at https://aws.amazon.com/contact-us/aws-training/
An API is a set of components that are linked together to create an application. This allows for easy scaling, operational management, and code management of individual parts of the application. Building APIs in a serverless environment allows you to design components that are optimized to work at scale. This also allows you to pay only for the services that you use. This is a great advantage; however, decoupled components in a cloud environment can be difficult to troubleshoot and fix if something goes wrong. AWS offers several tools designed to be easy to help you identify problems.
After completing this lab, you will be able to:
- Understand an event-driven architecture
- Enable and use AWS X-Ray and Amazon CloudWatch
- Understand how AWS Step Functions is configured to orchestrate serverless applications
- Take advantage of Amazon Simple Queue Service (Amazon SQS) and dead-letter queues
- Understand how to troubleshoot serverless architectures
- Make configuration updates to restore API functionality
This lab requires:
- Access to a notebook computer with Wi-Fi and Microsoft Windows, macOS X, or Linux (Ubuntu, SuSE, or Red Hat)
- The Qwiklabs lab environment is not accessible using an iPad or tablet device, but you can use these devices to access the student guide.
- For Microsoft Windows users: Administrator access to the computer
- An internet browser such as Chrome, Firefox, or Internet Explorer 9 (previous versions of Internet Explorer are not supported)
This lab requires 90 minutes to complete.
This lab is built around a photo book printing application. The application allows customers to upload a collection of images that they want printed in a physical book. Each image is processed to ensure that it is displayed properly in the book. The application uses AWS Step Functions to manage the workflow. The workflow uses AWS Lambda functions to make sure that each image is the proper file type and uses Amazon Rekognition to ensure that the content is appropriate. The workflow also resizes and watermarks the images and then generates a PDF proof for the customer to approve. Next, Amazon Simple Notification Service (Amazon SNS) sends an email to the customer for approval before sending the job to Amazon Simple Queue Service (Amazon SQS). Amazon SQS sends off the book to the third-party printing service to be printed and shipped to the customer.
Unfortunately, the application was broken by a recent code push, and customers are receiving several errors as they attempt to provide images for their books. You will troubleshoot all of the issues and fix the application.
The environment uses Amazon API Gateway, Lambda functions, Step Functions, Amazon Simple Storage Service (Amazon S3) buckets, Amazon DynamoDB tables, Amazon SQS queues, and Amazon SNS topics. Several errors have been introduced into the environment, and you need to troubleshoot and resolve these errors.
API Gateway is hosting several APIs in front of several Lambda functions. DynamoDB is used to store metadata about the images a user uploads. A Step Functions workflow is started to validate the images and render them for printing, before sending a link (via Amazon SNS) to the user for their verification. A user is able to preview a PDF of the book before sending it out to a third party for printing and shipping.
The following image is a high-level architecture diagram of the environment:
Click here to download a high-resolution version of the architecture diagram.
The following image is a detailed diagram of the image processing state machine. Use this to troubleshoot the application:
Click here to download a high-resolution version of the image processing state machine.
Image processing state machine diagram notes:
#0: /batch - This API Gateway is used for testing. It triggers a Lambda function that automates the user upload process contained in the orange box.
#1: /addAlbum - The user sends a request for presigned URLs to upload their images to.
#2: The user uses the presigned URLs to upload their images directly to Amazon S3.
#3: /CreateBookBinding - The user triggers the book creation process by indicating they have completed uploading images.
#4: /execution - The PDF is approved by either the user acknowledging an email from Amazon SNS or by proxy using Lambda for testing.
Note To facilitate testing, a Lambda function has been created to automatically generate random books. This will speed up the testing process by generating multiple books with several images each so that you can better identify application issues.
The following image is a detailed diagram of the book printing state machine:
Click here to download a high-resolution version of the book printing state machine.
Participe do Qwiklabs para ler o restante deste laboratório e muito mais!
- Receber acesso temporário a Console da Amazon Web Services.
- Mais de 200 laboratórios, do nível iniciante ao avançado.
- Tamanho compacto para que você possa aprender no seu próprio ritmo.