AWS For Developers For Dummies book cover

AWS For Developers For Dummies

Author:
John Paul Mueller
Published: August 14, 2017

Overview

Everything you need to get running with IaaS for Amazon Web Services

Modern businesses rely on Infrastructure-as-a-Service (IaaS)—a setup in which someone else foots the bill to create application environments—and developers are expected to know how to write both platform-specific and IaaS-supported applications. If you're a developer who writes desktop and web applications but have little-to-no experience with cloud development, this book is an essential tool in getting started in the IaaS environment with Amazon Web Services.

In Amazon Web Services For Developers For Dummies, you'll quickly and easily get up to speed on which language or platform will work best to meet a specific need, how to work with management consoles, ways you'll interact with services at the command line, how to create applications with the AWS API, and so much more.

  • Assess development options to produce the kind of result that's actually needed
  • Use the simplest approach to accomplish any given task
  • Automate tasks using something as simple as the batch processing features offered by most platforms
  • Create example applications using JavaScript, Python, and R
  • Discover how to use the XML files that appear in the management console to fine tune your configuration

Making sense of Amazon Web Services doesn't have to be as difficult as it seems—and this book shows you how.

Everything you need to get running with IaaS for Amazon Web Services

Modern businesses rely on Infrastructure-as-a-Service (IaaS)—a setup in which someone else foots the bill to create application environments—and developers are expected to know how to write both platform-specific and IaaS-supported applications. If you're a developer who writes desktop and web applications but have little-to-no experience with cloud development, this book is an essential tool in getting started in the IaaS environment with Amazon Web Services.

In Amazon Web Services For Developers For Dummies, you'll quickly and easily get up to speed on which language or platform will work best to meet a specific need, how

to work with management consoles, ways you'll interact with services at the command line, how to create applications with the AWS API, and so much more.
  • Assess development options to produce the kind of result that's actually needed
  • Use the simplest approach to accomplish any given task
  • Automate tasks using something as simple as the batch processing features offered by most platforms
  • Create example applications using JavaScript, Python, and R
  • Discover how to use the XML files that appear in the management console to fine tune your configuration

Making sense of Amazon Web Services doesn't have to be as difficult as it seems—and this book shows you how.

Amazon Web Services For Developers For Dummies Cheat Sheet

Developers have amazing opportunities today to create applications that span the entire planet. Use this cheat sheet to help you get the job done faster and easier when using AWS as your cloud-based solution of choice.

Articles From The Book

43 results

Cloud Computing Articles

Working with Auto Scaling in AWS

Autoscaling is a built-in feature that automatically adjusts how your AWS setup reacts to loads. Autoscaling is the service you use to make your RDS setup autoscale within limits that you specify. When you see the term autoscaling, think of the generic use of a feature (not necessarily a service) to make applications, services, and other AWS features add and remove resources as needed to make applications scale better and provide a consistent user experience. When you see Auto Scaling, think about the service that you specifically use to make autoscaling feasible with certain AWS services. The Auto Scaling feature enables your EC2 instances to handle loads without a lot of human intervention.

Applying Auto Scaling

You have several options for applying Auto Scaling to your running EC2 instance (instances that have an Instance State other than Running won’t allow you to apply Auto Scaling), but the easiest method is to select one or more EC2 instances in the Instances page and then choose Actions →   Instance Settings →   Attach to Auto Scaling Group. You see the Attach to Auto Scaling Group dialog box. If you haven’t created an Auto Scaling group, you need to choose the A New Auto Scaling Group option, as shown. Type a name for the group in the Auto Scaling Group Name field, such as MyAutoScaleGroup, and then click Attach. AWS then automatically creates an Auto Scaling group for you that uses precisely the same settings as the selected EC2 instances.

Removing Auto Scaling

Unfortunately, you can’t remove an EC2 instance from an Auto Scaling Group in the Instances page. Use the following steps to remove an EC2 instance from an Auto Scaling Group.
  1. Choose Auto Scaling →  Auto Scaling Groups in the Navigation pane. You see the Auto Scaling Group page. You may need to click an Auto Scaling Groups link to see the list of groups.
  2. Select the Auto Scaling Group for the EC2 instance.
  3. Select the Instances tab of that group. You see a listing of EC2 instances attached to that group.
  4. Select the EC2 instance that you want to remove and then choose Actions →   Detach in the Instances Panel. Make sure that you choose the lower of the two Actions buttons. You see a Detach Instance dialog box.
  5. Click Detach Instance. AWS removes the EC2 instance from the Auto Scaling Group.

Simply deleting the Auto Scaling Group terminates the attached EC2 instance. After an EC2 instance is terminated, you can’t recover it and must recreate the instance from scratch. The best way to avoid this problem is to provide your EC2 instance with termination protection by choosing Instance Settings →   Change Termination Protection on the Instances page for the selected EC2 instance. You see a dialog box in which you confirm that you want to enable termination protection.

Cloud Computing Articles

How to Download a Local Copy of DynamoDB from AWS

In contrast to many of the other AWS services, you can actually get a local copy of DynamoDB that you can work with offline. Using DynamoDB offline, on your local machine, means that you can try various tasks without incurring costs or worrying about potential connectivity issues. In addition, you can use DynamoDB in a test environment, in which you use a copy of your data to mimic real-world situations. Here, you discover how to obtain and install a local copy and then use your copy with Python to perform a test.

Performing the installation

To start using a local copy of DynamoDB, you need Java installed on your system because Amazon supplies DynamoDB as a .jar file. You can obtain a
user-level version of Java. However, if you plan to perform any customizations or feel you might need debugging support, then you need a developer version of Java (the Java Development Kit or JDK). Make sure to get the latest version of Java to ensure that DynamoDB works as expected. The next step is to download a copy of DynamoDB and extract the files in the archive. Note that you can get versions of DynamoDB that work with Maven and Eclipse. These instructions assume that you use the pure Java version and that you’ve extracted the downloaded archive to a folder named DynamoDB on your hard drive. You may need to bury the archive a level or two deep, but make sure that the path doesn’t contain spaces. The main file you deal with is DynamoDBLocal.jar.

Starting DynamoDB locally

Open a command prompt or terminal window and ensure that you’re in the location where you extracted the DynamoDB archive (using the CD command). Type java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar –sharedDb and press Enter to start DynamoDB. Depending on your operating system, you see some startup messages.

When working with Windows, you should also see the message below (other platforms may show other messages). This firewall message tells you that port 8000 isn’t currently open. To make DyanmoDB work properly, you must allow access. If you want to change the port, use the -port command-line switch with a different port number. The page that contains the DynamoDB links also has a list of other command-line switches near the bottom, or you can use the -help command-line switch to see a listing for these command line switches locally.

Overcoming the Windows OSError issue

When working with Windows, you may encounter a problem that involves seeing an OSError message output for some Python calls, even if your code is correct. The problem is with the tz.py file found in the \Users\\Anaconda3\Lib\site-packages\dateutil\tz folder of your Anaconda setup (the same file exists for every Python setup, but in different folders). To fix this problem, you must change the code for the _naive_is_dst() function so that it looks like this: def _naive_is_dst(self, dt): # Original Code timestamp = _datetime_to_timestamp(dt) #return time.localtime(timestamp + time.timezone).tm_isdst # Bug Fix Code if timestamp+time.timezone < 0: current_time = timestamp + time.timezone + 31536000 else: current_time = timestamp + time.timezone return time.localtime(current_time).tm_isdst Fortunately, you don’t have to make the change yourself. You can find the updated tz.py file in the downloadable source, as explained in the Introduction. Just copy it to the appropriate folder on your system. At this point, you can begin using your local copy of DynamoDB to perform tasks.

Cloud Computing Articles

How to Use the Console to Perform a Database Query in AWS

Finding data in AWS that you need can become problematic. A few records, or even a few hundred records, might not prove to be much of a problem. However, hundreds of thousands of records would be a nightmare to search individually, so you need to have some method of finding the data quickly. This assistance comes in the form of a query. DynamoDB actually supports two query types:

  • Scan: Uses a filtering approach to find entries that match your criteria.
  • Query: Looks for specific attribute entries.
The examples here employ two test entries in the TestDB table. The essential entries are the EmployeeID, EmployeeName, and EmploymentDate attributes, shown here: The two methods of querying data have advantages and disadvantages, but what you use normally comes down to a matter of personal preference.

Using a scan

Scans have the advantage of being a bit more free-form than queries. You filter data based on any field you want to use. To scan the data, you choose either a [Table] entry that contains the primary key and sort key, or an [Index] entry that sorts the data based on a secondary index that you create. Using a scan means deciding on what kind of filtering to use to get a desired result. The following steps give you a template for a quick method of performing a scan. (Your steps will vary because you need to provide specific information to make the procedure work.)
  1. Choose Scan in the first field.
  2. Select either a [Table] or [Index] entry in the second field. The entry you choose determines the output’s sort order. In addition, using the correct entry speeds the search because DynamoDB will have a quick method of finding the data.
  3. Click Add Filter (if necessary) to add a new filter entry. You can remove filters by clicking the X on the right side of the filter’s entry.
  4. Choose an attribute, such as in the first Filter field.
  5. Select the attribute’s type in the second Filter field.
  6. Specify a logical relationship in the third Filter field. This entry can be tricky, especially when working with strings. For example, if you want to find all the entries that begin with the name George, you choose the Begins With entry in this field. However, if you want to find all the employees hired after 11/08/2016, use the > entry instead.
  7. Type a value for the fourth Filter field, such as George.
  8. Click Start Search.
You see the entries that match your filter criteria. You can use as many filters as desired to whittle the data down to just those items you really want to see. Simply repeat Steps 3 through 8 to achieve the desired result.

Using a query

Queries are stricter and more precise than scans. When you perform a query, you look for specific values. Notice that the key value is precise. You can’t look for a range of employment dates; instead, you must look for a specific employment date. In addition, the employment date is a mandatory entry; you can’t perform the query without it. However, you can also choose an optional sort key and add filtering (as found with scans) as well. Using a query is like asking a specific question. You can ask which employees, who were hired on 02/28/2015, have a name that begins with Hal. In this case, you see just one record. Scans can produce the same result by employing multiple filters. The advantage of a query is that it forces you to think in a particular way; also, because you use attributes that are indexed, using a query is faster than a scan.