Chapter 8

8.1. The interaction model


To make your application easy to use for a broad range of use cases, the main interface for your users is the web browser. Via a web browser, users can access static HTML pages that include JavaScript code, which can call one or more Lambda functions to execute code in the back end.


Using the Amazon API Gateway


Another option, instead of calling Lambda functions directly from the client application, is to model a RESTful API with the Amazon API Gateway, using features similar to what you learned in chapter 3. 

The advantage of this approach is the decoupling of the client application from the actual back-end implementation:


You call a Web API from the client application and not a Lambda function.
You can easily change the back end implementation to (or from) AWS Lambda at any time, without affecting the development of the client application (for example, a web or mobile app).




You can potentially open your back end to other services, publishing a public API that can further extend the reach of your application.


The HTML pages, JavaScript code, and any other file required to render the page correctly on the web browser (such as CSS style sheets) can be stored on Amazon S3 as publicly readable objects. 

Because the client side of the application is built using HTML pages and JavaScript code, it’s relatively easy to repackage it as a hybrid mobile app






Amazon SES is a fully managed email service that you can use to send any volume of email, and receive emails that can be automatically stored on Amazon S3 or processed by AWS Lambda.


When you receive an email with Amazon SES, you can also send a notification using Amazon Simple Notification Service (SNS). For more information on Amazon SES, see 


8.2. The event-driven architecture


Every static HTML page you put on Amazon S3 can potentially be used as an interactive step to engage the user. 

If you compare this with a native mobile app, each of those pages can behave similarly to an activity in Android or a scene in iOS.


8.3. Working with Amazon Cognito


To use the authentication service with Amazon Cognito, you need to add to the login Lambda function a call to Amazon Cognito to get a token for a developer identity. 

The login function can then return the authentication token for a correct authentication.

The JavaScript code in the page can use that token to authenticate with Amazon Cognito and get AWS temporary credentials for the authenticated role (figure 8.8).




No comments:

Post a Comment

To All, If you are working in starter accounts please move the work into the classroom account so I can review. For the previous ...