Up and Running with Amazon Web Services
Illustration by Richard Downs

Up and Running with Amazon Web Services

with Jon Peck

Video: Pushing notifications with the Simple Notification Service

The Amazon Simple Notification Service, or SNS for short, is a web service for sending notifications. SNS allows push notifications to be sent, meaning that whatever is getting the notifications doesn't need to check SNS for them. Notifications can be sent to a number of recipients, including http for servers, email and SMS text messages to phones. Amazon SNS is intended for small notifications and the features of this service reflects that. Starting with a maximum size of messages which is 64 kilobytes, the restriction is structured to be optimal for simple text and tiny structures.

Start your free trial now, and begin learning software, business and creative skills—anytime, anywhere—with video instruction from recognized industry experts.

Start Your Free Trial Now
please wait ...
Watch the Online Video Course Up and Running with Amazon Web Services
1h 43m Intermediate Feb 19, 2013

Viewers: in countries Watching now:

Discover how Amazon Web Services (AWS) can be leveraged to deploy and scale your web applications. Author Jon Peck demonstrates how to build a simple application leveraging the Amazon cloud services while introducing the wide variety of products and services provided with AWS.

This course starts with an overview of the foundational services, such as Amazon EC2 for virtual servers, Amazon S3 for online data storage, and Amazon RDS for a scalable database solution. Plus, explore how application services such as the Amazon Simple Notification Service can reduce overhead. Jon combines these services in the final chapter, where he builds, deploys, and monitors an application.

Topics include:
  • What is Amazon Web Services?
  • Understanding the AWS terminology
  • Exploring the foundation services
  • Using tools for managing and administration of AWS
  • Signing up for services
  • Launching and managing EC2 instances
  • Configuring the software development kit (SDK) with AWS credentials
  • Storing objects in Amazon S3
  • Pushing notifications
  • Managing the workflow
Subject:
Developer
Software:
AWS
Author:
Jon Peck

Pushing notifications with the Simple Notification Service

The Amazon Simple Notification Service, or SNS for short, is a web service for sending notifications. SNS allows push notifications to be sent, meaning that whatever is getting the notifications doesn't need to check SNS for them. Notifications can be sent to a number of recipients, including http for servers, email and SMS text messages to phones. Amazon SNS is intended for small notifications and the features of this service reflects that. Starting with a maximum size of messages which is 64 kilobytes, the restriction is structured to be optimal for simple text and tiny structures.

Each subscriber must confirm the subscription to notifications which can be a bit cumbersome, especially as this includes servers which need a mechanism for confirming this description in addition to being able to receive a notification. The notifications can be sent in one or two formats: plain text, emails and SMS and JSON encoding which is optimal for server communication. SNS in good for internal status notifications in triggered events such as a payment problem being reported to an administrator or server triggers. It's not good for mass emailing users due to subscription confirmations, formats and other limitations.

The Simple Notification Service has its own set of terminology, but in comparison to other services, it's fairly small. A topic is the name of a group of subscribers. Topics are typically named for the subject in the notifications or some sort of underlying event type like server failures. As mentioned before, clients can subscribe to a topic. A topic owner, the account that created the topic, can directly subscribe clients. Regardless of how they subscribe, the client must always confirm the subscription.

Amazon SNS subscriptions are interesting as it really highlights how these messages are not intended for end-users. Subscribers to SNS notifications need to specify the protocol and endpoint. The protocol can be things like HTTP, email, SNS and others, while the endpoint is the recipient address; this includes an email, a URL or SMS number. When the description request is received, a confirmation is sent for explicit opt-ins by replying or clicking a link. If unconfirmed, no notifications will be sent and an unconfirmed subscriber will be removed in three days.

Notifications are not archived so they can't be reviewed later, so take that in a consideration when using the service. There is a number of different steps in the SNS workflow so I'll go over at a high level. First, the topic is created. A recipient subscribes and confirms their notification. Notifications are then published which trigger SNS to deliver the notifications. Now that I've provided some context into how Amazon SNS works, let's configure it for use with the watermarking application. Switching to the browser, go to the Management Console.

From the menu, go to Services > App Services > SNS. As this is the first time that I have used this system, there are no topics created. I can see the number of SNS topics that I managed along with a number of subscriptions in the upper right-hand corner. I am going to create a new topic for the watermarking application. So click on Create New Topic. Topic names are 256 alphanumeric characters, meaning A through Z, 0 through 9, additionally hyphen and underscore included.

I am going to use SNS to notify myself when there is a bad uploaded file. So I'll give it a logical name, watermark-bad-upload. For the Display Name, I'll give it a descriptive short name, WM for watermark, BAD for problem and UL for upload. Remember, these notifications aren't for end-users, so briefness is just fine. When ready, click Create Topic. Basic information about the topic is now shown.

Topic Amazon Resource Name, or ARN, is a unique identifier that is used programmatically. Topic owner, region and display name are self-explanatory. The list of subscribers which is currently empty is shown below. Clicking on all topic actions, a number of options are shown. Publish sends messages which I'll demonstrate shortly. Topic Policy gives control over who can publish and subscribe to the topic. The topic delivery policy controls the number of retries, seconds of delay and rate limiting.

It's good to have an audience for notifications even if it's an audience of one, so click Create New Subscription. This form has two options, the first, protocol, determines how messages will be delivered. I want to send myself a text message whenever there is a non image uploaded, so I'll select SMS as the protocol. The end-point indicates where the messages are going which be my producer cell phone number, click Subscribe. A text message will be sent from Amazon to confirm the subscription.

Follow the directions which are to reply with a text saying yes and the display name. So it will be yes WMBADUL. Once confirmed, close the message, click Refresh on the AWS page. An explicit subscription ID is shown along with a protocol endpoint and subscriber. To test the system, click Publish to Topic. The first input is the subject which should be left off for SMS messages.

If it's included, it will be shown as part of the message. The larger box for message is self-explanatory, but the option beneath allows different messages per protocol, such as a longer more detailed message via email and a simple summary as text. Leave the subject blank and for the message, I'll type "There was a bad upload from IP..." Click Publish Message, it will show a confirmation and just click Close. In a moment, a message will be sent.

SMS messages will append the display name followed by the message itself. Now that I have the topic, I can perform the final piece of configuration. I am going to switch to the terminal with a remote connection and reconnect if necessary. Then I'll update the configuration: sudo nano -w /var/www/html/config.inc.php, and for the SNS_TOPIC we'll do watermark- bad-upload, exit and save.

The notification will now be published if someone uploads non-image file to the watermarker. That's not practical in the long run, but it's good for testing. I have all the services necessary for the watermarker, so it's time to put it all together.

There are currently no FAQs about Up and Running with Amazon Web Services.

 
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ .

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

* Estimated file size

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Up and Running with Amazon Web Services.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member ?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferences from the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Learn more, save more. Upgrade today!

Get our Annual Premium Membership at our best savings yet.

Upgrade to our Annual Premium Membership today and get even more value from your lynda.com subscription:

“In a way, I feel like you are rooting for me. Like you are really invested in my experience, and want me to get as much out of these courses as possible this is the best place to start on your journey to learning new material.”— Nadine H.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.