Reader small image

You're reading from  AWS Certified Solutions Architect ??? Associate Guide

Product typeBook
Published inOct 2018
PublisherPackt
ISBN-139781789130669
Edition1st Edition
Tools
Right arrow
Authors (2):
Gabriel Ramirez
Gabriel Ramirez
author image
Gabriel Ramirez

Gabriel Ramirez is a passionate technologist with a broad experience in the Software Industry, he currently works as an Authorized Trainer for Amazon Web Services and Google Cloud. He is holder of 9/9 AWS Certifications and does community work by organizing the AWS User Groups in Mexico.
Read more about Gabriel Ramirez

Stuart Scott
Stuart Scott
author image
Stuart Scott

Stuart Scott is the AWS content lead at Cloud Academy where he has created over 40 courses reaching tens of thousands of students. His content focuses heavily on cloud security and compliance, specifically on how to implement and configure AWS services to protect, monitor and secure customer data in an AWS environment. He has written numerous cloud security blogs Cloud Academy and other AWS advanced technology partners. He has taken part in a series of cloud security webinars to share his knowledge and experience within the industry to help those looking to implement a secure and trusted environment. In January 2016 Stuart was awarded 'Expert of the Year' from Experts Exchange for his knowledge share within cloud services to the community.
Read more about Stuart Scott

View More author details
Right arrow

Integrating Application Services

Information systems are not reliable by nature, since any component can fail; however, it is possible to improve a system's reliability and availability by distributing them among redundant components, and these components can represent individual service layers, each one with a higher level of cohesion.

Imagine the following scenario: I wish to deliver a letter and receive a confirmation when the letter has arrived. I only know the sender address and the post office that the letter must be picked up from:

This letter represents the content of the message I want to deliver, but in the process, some problems may arise. If I deliver the letter personally, I may run the risk of not finding the recipient in time, so I will need to return again, and if the delivery must be done across many areas of the world, additional considerations such as...

Technical requirements

In this chapter, we will create an IAM user that will allow us to interact from an administrative point of view with the message queue. To avoid friction with this process, let's use the following script: http://bit.ly/2P3Rj6y.

Make sure to download the trust policy file, trust-policy-for-sqs.json, in the same path where you executed the previous shell from: http://bit.ly/2nDrUnM.

It is assumed that the key pair has been configured for the AWS CLI and that you have administrator access to create IAM users. Execute the following command:

chmod +x && ./create-sqs-user-and-role.sh

The script will perform the following tasks:

  • Create the sqs-user
  • Create a key pair for the sqs-user
  • Configure the [sqs-user] profile in ~/.aws/credentials
  • Create a service role for EC2
  • Create an instance profile for EC2
...

SQS as a reliable broker

Messaging systems use a broker to handle communications. These systems are designed to provide a communication buffer between distributed components, and they exchange information through messaging channels known as queues, encapsulating data in messages.

Messaging promotes the integration of many heterogeneous technologies through a communication bus that's completely agnostic to operating systems and programming languages. Let's imagine two applications: one written in Python and the other in Java. If both applications use Simple Queue Service (SQS), we can gain interoperability between platforms and work with string objects that can contain any kind of message structure; for example, XML or JSON.

Asynchrony

...

Managing 1:N communications with SNS

The Simple Notification Service (SNS) is a messaging service designed to work with publisher/subscriber semantics by decoupling distributed system components using an event model based on asynchronous push messaging. This way, every topic subscriptor receives a copy of the message that is broadcast.

The message is a first-class citizen, with the flexibility to re-routed between components and applications with a high level of interoperability, since messages are composed of text with a maximum limit of 256 KB. The message can contain payload and attributes, and these attributes can be used to filter messages and provide contextual information about the message. The message payload can be encrypted to provide additional security aspects for communication.

...

Authenticating your web and mobile apps with Cognito

Authentication capabilities in applications should be simple and safe by default. Designing customized authentication systems takes a long time and is a specialized endeavor. The users of these applications want to explore an app's functionality without spending too much time creating user accounts. It is our main goal to minimize the friction associated with this processes as much as possible.

Newer users feel comfortable using their existing credentials and use them in multiple authentication facades. This practice is called federation (the word federation originates from the latin foederatio, which means union). These credentials that are external to our systems can be used to produce security assertions in the form of tokens. The representations of the original credentials can be used to assume an identity or to gain...

WebSockets in AWS

Real-time applications are a real challenge, and this is because additional infrastructure and protocols must be met. WebSockets come to the rescue by providing bi-directional communication between the client and the server. In the old days, when the Classic Load Balancer was the only option the way to balance web sockets communication was to work in TCP mode, delegating the WebSocket duplex function to a service proxy such as NGINX to upgrade the connection or using some framework such as socket.io.

AWS IoT

AWS IoT is a service designed to connect objects to the IoT via the SDK; you can use the WebSockets via MQTT, a lightweight protocol designed for unreliable networks, and this way, you can push messages...

Web app demo

To perform this demo, it is recommended to follow the AWS IoT chat application; you can find further instructions on the GitHub repo: https://github.com/aws-samples/aws-iot-chat-example.

This example walks you through a web app real-time application using the following services:

  • AWS IoT, to exchange messages between web clients
  • Transmit messages using the MQTT over the WebSocket protocol to reduce network bandwidth requirements
  • Authenticate clients with Amazon Cognito and attach IoT policies to allow clients to do the following:
    • Connect to the AWS IoT Device Gateway
    • Publish messages to specific topics
    • Subscribe and receive messages from specific topics
  • Authentication with Amazon Cognito user pools and Cognito federated identities
  • Serverless computing with AWS Lambda
  • API access control provided by Amazon API Gateway
  • Room persistence via Amazon DynamoDB
  • Static site...

Summary

In this chapter, we covered the uses of messaging systems, the publisher and subscriber perspectives, and how to integrate them into applications. We also discussed multiple messaging patterns such as the queuing chain pattern, job observer, and priority queue.

We also used the simple notification service to produce fan-out to integrate into SQS and manage one-to-many communications.

In the third section, we introduced Amazon Cognito user pools and federated identities while explaining the use cases for each one. API Gateway is used to deploy a RESTful API with mock implementations.

Lastly, we covered WebSockets and which technologies are available in AWS to work with WS and best practices, and, finally, we looked at a web app showing how all the integration services discussed in this chapter can be used in a web application.

...
lock icon
The rest of the chapter is locked
You have been reading a chapter from
AWS Certified Solutions Architect ??? Associate Guide
Published in: Oct 2018Publisher: PacktISBN-13: 9781789130669
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Authors (2)

author image
Gabriel Ramirez

Gabriel Ramirez is a passionate technologist with a broad experience in the Software Industry, he currently works as an Authorized Trainer for Amazon Web Services and Google Cloud. He is holder of 9/9 AWS Certifications and does community work by organizing the AWS User Groups in Mexico.
Read more about Gabriel Ramirez

author image
Stuart Scott

Stuart Scott is the AWS content lead at Cloud Academy where he has created over 40 courses reaching tens of thousands of students. His content focuses heavily on cloud security and compliance, specifically on how to implement and configure AWS services to protect, monitor and secure customer data in an AWS environment. He has written numerous cloud security blogs Cloud Academy and other AWS advanced technology partners. He has taken part in a series of cloud security webinars to share his knowledge and experience within the industry to help those looking to implement a secure and trusted environment. In January 2016 Stuart was awarded 'Expert of the Year' from Experts Exchange for his knowledge share within cloud services to the community.
Read more about Stuart Scott