Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Amazon EC2 Cookbook

You're reading from  Amazon EC2 Cookbook

Product type Book
Published in Nov 2015
Publisher Packt
ISBN-13 9781785280047
Pages 194 pages
Edition 1st Edition
Languages

Table of Contents (15) Chapters

Amazon EC2 Cookbook
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Preface
1. Selecting and Configuring Amazon EC2 Instances 2. Configuring and Securing a Virtual Private Cloud 3. Managing AWS Resources Using AWS CloudFormation 4. Securing Access to Amazon EC2 Instances 5. Monitoring Amazon EC2 Instances 6. Using AWS Data Services 7. Accessing Other AWS Services 8. Deploying AWS Applications Index

Chapter 7. Accessing Other AWS Services

In this chapter, we will cover recipes for:

  • Configuring Route 53

  • Accessing AWS S3 from applications

  • Accessing AWS SES from applications

  • Accessing AWS SNS from applications

  • Accessing AWS SQS from applications

Introduction


In this chapter, we will cover other services from AWS that help you store files and messages and send e-mails and notifications.

AWS Route 53 provides domain name registration service, DNS, and a health-checking service for your application. You can use any combination of these services. For example, you can use Route 53 as the DNS service to convert domain names to IP addresses for your registered domain name.

AWS Simple Storage Service (S3) provides a highly scalable and reliable data storage service. You can use S3 to store and retrieve any amount of data, including images, videos, and other content. You can also host and serve your static website from AWS S3.

AWS Simple Email Service (SES) is an e-mail platform that allows you to send and receive e-mail using your own e-mail address. You add e-mail functionality to any of your applications running on Amazon EC2 via AWS SDKs or the SES API. AWS manages the IP address reputation and the e-mail server and network infrastructure...

Configuring Route 53


AWS Route 53 provides domain name registration service, DNS, and a health-checking service for your application. There are SDKs available for many popular programming languages, including Java, Python, NodeJS, Go, .Net, and PHP. If you have a VPC, you can make use of a Private Hosted Zone for Amazon VPC. Using this private DNS, your resources are not accessible outside the VPC. Route 53 supports latency-based routing, if your application is hosted on two different AWS data centers, when the user makes a request, Amazon Route 53 chooses to respond to the DNS query based on which data center gives your user the lowest latency.

How to do it…

  1. Installing AWS Java SDK.

    In your Maven dependency section, add the following dependency for AWS Java SDK Version 1.9.28.1. You can find the latest Java SDK version in this link http://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk.

    <dependency>
        <groupId>com.amazonaws</groupId>
        <artifactId>aws-java...

Accessing AWS S3 from applications


AWS S3 is highly scalable and durable object storage. You only have to pay for the storage you actually use. S3 replicates data in multiple data centers within the region. Further, AWS S3 introduces cross-region replication that replicates your data across AWS regions. In this recipe, we cover both uploading objects to and downloading objects from AWS S3.

How to do it…

  1. Installing AWS Java SDK.

    In your Maven dependency section, add the following dependency for AWS Java SDK Version 1.9.28.1:

    <dependency>
        <groupId>com.amazonaws</groupId>
        <artifactId>aws-java-sdk</artifactId>
        <version>1.9.28.1</version>
    </dependency>
  2. Create a bucket.

    The following sample Java program creates a S3 bucket called laurenceluckinbill in the Singapore region:

        // Create S3 bucket.
            public static void CreateBucket() {
    
            // Create BasicAWSCredentials with Access Key Id and Secret Access Key.
            BasicAWSCredentials...

Accessing AWS SES from applications


Sending e-mails to users from your applications is a very common requirement. Provisioning hardware and installing the mail server software in your own data center adds to the upfront costs, aside from the security and high-availability concerns. AWS Simple Email Service (SES) is an e-mail platform from AWS. For example, when you want to send e-mail messages, Amazon SES is your outbound e-mail server. Alternatively, you can configure your existing e-mail server to send the e-mails via Amazon SES.

You can track deliveries, bounced messages, complaints, and rejects from the AWS console, or access the same via the SES API. You can view the e-mail volume limits for your account. You can request an increase in your quota by providing some basic information on e-mail content, and many more to AWS. You can use any standard SMTP library or the AWS SDK to interact with SES.

How to do it…

  1. Verify the e-mail address.

    Execute the following sample command to verify the...

Accessing AWS SNS from applications


AWS SNS helps you send e-mail, SMS, and mobile push notifications very efficiently. The subscribers of the messages receive the messages over one of the supported protocols such as HTTP/S, SMS, e-mail, and Amazon SQS.

If you are targeting an HTTP(S) endpoint from SNS, then it is highly recommended that your HTTP(S) application be highly available to avoid message drops. For reliable messaging, you can store the notification messages to Amazon SQS.

Mobile push notifications are typically used for application alerts, push e-mails and SMS, and mobile push notifications. A use case for mobile push notifications could be to prompt your inactive users back to using your application again. Targeting mobile platforms for mobile notifications requires integration with different libraries for different platforms. AWS SNS provides a single interface for all these platforms. You send a single push message to SNS, and then SNS sends this message to different platforms...

Accessing AWS SQS from applications


SQS is a scalable, fast, and fully managed distributed queuing service from AWS. AWS SQS helps you build loosely coupled applications. This allows the application components to run independently with SQS managing the message flow between them. SQS can act as a buffer between the writers and the readers of the messages, and each queue can support multiple writers and readers.

Minimum SQS message size is 1 KB, maximum message size is 256 KB. Messages in SQS queues are stored for 4 days; however, you can increase the retention period from 1 minute to 14 days. You can create an unlimited number of queues, and a queue can contain unlimited number of messages.

AWS SQS supports long polling, so instead of querying SQS every 10 seconds with no results, you can send the request to the SQS. It responds whenever there is a message present in that specific queue.

There is no upfront cost to pay, and you only pay for what you use. Note that due to the distributed nature...

lock icon The rest of the chapter is locked
You have been reading a chapter from
Amazon EC2 Cookbook
Published in: Nov 2015 Publisher: Packt ISBN-13: 9781785280047
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.
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 €14.99/month. Cancel anytime}