1. Home
  2. Training Library
  3. Amazon Web Services
  4. Amazon Web Services Courses
  5. Certified Developer for AWS - Designing and Developing

Using Amazon SNS

Start course
2h 45m

An introduction to the AWS components that help us develop highly available, cost-efficient solutions.

Learning Objectives

  • Understand the core AWS services, uses, and basic architecture best practices
  • Identify and recognize cloud architecture considerations, such as fundamental components and effective designs

Areas Covered

Elasticity and Scalability
Regions and AZ's
Amazon VPC
Amazon Elastic Load Balancer
Amazon Simple Queue Service
Amazon EC2
Amazon Route53
Amazon Elastic IP Addresses
Amazon CloudWatch
Amazon Auto Scaling

Identify the appropriate techniques to code a cloud solution
Recognize and implement secure procedures for optimum cloud deployment and maintenance
Amazon APIs
Using Amazon SQS
Decoupling Layers
Using Amazon SNS
Using Amazon SWF
Using Cross Origin Resources (CORS)

If you have thoughts or suggestions for this course, please contact Cloud Academy at support@cloudacademy.com.


Hi, In this lecture we'll talk about AWS's Simple Notification Service and I'll provide a service overview that we'll cover most of the topics you'll need.

Simple Notification Service is a push notification service that lets you target recipients referred to as end points by AWS. You can have messages delivered two different types of end points using a single API call. Let me show you how it works. Let's head to the SNS page at the AWS console. SNS works with topics, topics are resources that you can use to send messages to the various end points. Let me create one to show. We just need to get the topic a name and a display name, the display name will be like a topic's identifier that will be sent with the messages.

Now that we have a topic, we can assign subscriptions to it. Every single end point should be confirmed because AWS doesn't want to send messages to people who don't want to receive them. Here we can add end points to this topic and for that we have to define the protocol we want to use. AWS currently has seven choices of end point type, each one of them has its own specific rules. To use the HTTPS protocol, for instance, you can have a web server somewhere prepared to receive an HTTPS put message and process this message somehow maybe by starting an EC2 instance or adding another EBS volume to an instance or anything else. The options are many and it's up to you to define them. In my case, I'll use this topic to send messages to my personal email. For that I need to put my email address here and specify the right protocol. AWS has a nice protocol called email JSONJSON which is basically a way to send an email in the JSONJSON format so it will become easier to process the contents. You could then define a process to read emails in JSONthe JSON format and process them as you need on the HTTPS server.

In my case, I'm just using this to show you what a message contains and that it's easier with email JSON. I just need to type my email address and create the subscription and I have to go to my personal email client and confirm that I want to receive messages from this topic.

I'll pause the recording to do that and then I'll come back here to show some more about its Simple Notification Service. Now that I've confirmed this description on my email, I can publish messages to this topic and receive them in my personal email account. To do that, we go to publish message, type the subject of the message and the message itself. The nice thing that AWS provides is the option to define custom messages to the different end points you can have on a single topic.

To do that via the AWS console, you could write your message in a JSON format defined by AWS. To avoid reading all the documentation, you could also simply go here and create the message, selecting the end points that you want.

In my case, I want them all. Now that we have the message in JSON format, we can change the content of the message here by changing the message for the end points.

It's really simple to understand, you just need to look for the end point that you want and change the message only for the specific type of end point. In this example, that is, only the email end points will receive a custom message the email JSON are not on this group. We can click on publish message and the message will be sent. Another important part of the Simple Notification Service is the ability to send messages to mobile end points. For that we need to have a special configuration that is found in the applications menu. Following the same thinking of the other end points, AWS does not want messages sent to anyone who doesn't want them. So to send messages to a cell phone, we would have to create an application and set up an external messaging platform to work with this application. This way, you could manage the mobile end point subscriptions outside SNS and we'd only need to set up the messaging platform that you want to use in here for each type of mobile device.

For example, for iOS you would have to set up an application for an Apple messaging platform or use Google to Android devices.

You don't need to know how to do this for the exam, you just need to understand how to manage mobile end points with SNS. For that, just remember that you need to set up an application to manage device subscriptions on an external messaging platform. Your SNS topic will only send a message to the application that you set up. Another important topic is message contents. That is why I defined my end point as email JSON to show you what I received. Every message has these fields and it's important for the exam that you know about them.

First of all, the type defines the message type;in this case it's a notification. In the confirmation email we see subscription confirmation; this is the message ID. It's the unique identifier of the message.

Every message will have its own ID. The message ID is the same for all the end points. The topic ARN is, as the name suggests, the name of the topic that sent this message. This way you could identify the origin of the message. For example, the subject is the subject that we defined when we published the message. This is the message itself; in this case it's only saying hello. Remember that we change the message only for email end points. Tt was not changed in our case because email JSON end points are different from emailend points and the message we are seeing is a default message from what we defined. This is the time when the message was sent.

This is the signature version of the signature itself. Every message is signed with a certificate. You could, for instance, get the signature and compare it with the certificate to confirm the authenticity of the message. AWS has tutorials for all these topics. I If you want to know more, take a look at the documentation, but it's not required for the exam. This is the URL for the certificate that I mentioned in the last field, and this is the unsubscribe URL.

You can unsubscribe an end point at any point by accessing this URL. As I said many times, AWS does not want to send you unwanted messages so, at any time, you can click on this URL and unsubscribe from the topic.

About the Author
Learning Paths

Andrew is fanatical about helping business teams gain the maximum ROI possible from adopting, using, and optimizing Public Cloud Services. Having built  70+ Cloud Academy courses, Andrew has helped over 50,000 students master cloud computing by sharing the skills and experiences he gained during 20+  years leading digital teams in code and consulting. Before joining Cloud Academy, Andrew worked for AWS and for AWS technology partners Ooyala and Adobe.