cover.eps

Title page image

AWS® For Developers For Dummies®

To view this book's Cheat Sheet, simply go to www.dummies.com and search for “AWS For Developers For Dummies Cheat Sheet” in the Search box.

Introduction

With the availability of cloud-based resources, developers today have an unprecedented opportunity to create amazing applications that previously weren’t possible. Amazon Web Services (AWS) enables developers to interact with the entire world, even when their application supports the smallest of organizations. The access to services in the cloud is amazing enough, but the access to data and other resources is now at mind-boggling levels. Unfortunately, many developers are indeed overawed by the sheer size and scope of cloud-based development, which is why you need AWS For Developers For Dummies.

This book is about making things simple. You don’t have to try to understand the entire cloud or even just AWS in a single sitting; instead, AWS For Developers For Dummies breaks down all the concepts into smaller chunks. If you want to create imaginative applications, this books helps you do so without spending frustrating hours learning the arcane AWS API beforehand. Life is short. With this book, you can create an application in just a few hours and become productive more quickly, freeing you from the drudgery of learning quite a lot to do only a little.

About This Book

The purpose of AWS For Developers For Dummies is to help you get up and running quickly. You build a test environment and install tools that let you experiment with many of the major services without a lot of effort. The focus of this book is to get you started doing something by using just a few of the services. One of the hardest parts of working with AWS is that so many services are available (more than 100 of them) that a developer might go nuts just trying to figure out where to begin. This book relieves you of that problem.

Most of the book examples focus on three kinds of AWS interaction: through the console, through the Command Line Interface (CLI), and programmatically. In most cases, these are the three ways developers begin working with AWS. The console lets you see how AWS works from an administrative level. Using CLI helps you understand the AWS functionality at a deeper level, plus you can use it to create scripts. Finally, this book uses Python Notebooks to make experimentation very easy. You don’t have to write complete applications to see something happen; just a few lines of code will do. So, in contrast to other programming projects, in which you spent hours writing code just to see the project die because of the smallest typo, this book helps you attain something significant without much typing at all.

To help you absorb the concepts, this book uses the following conventions:

Foolish Assumptions

You might have a hard time believing that I’ve assumed anything about you — after all, I haven’t even met you yet! Although most assumptions are indeed foolish, I made certain assumptions to provide a starting point for the book.

The first assumption is that you’re familiar with the platform you want to use, because the book doesn’t offer any guidance in this regard. This book doesn’t discuss any platform-specific issues. You really do need to know how to install applications, use applications, and generally work with your chosen platform before you begin working with this book.

You also need to be familiar with your browser and understand how to interact with browser-based applications. Sprinkled throughout are numerous references to online material that can enhance your learning experience. In addition, most of the tasks you perform with AWS require that you work in your browser.

This book is largely platform independent. However, none of the procedures are tested using small mobile devices, such as a smartphone (and some are almost guaranteed not to work on a small device). Differences in appearance do emerge when using a smaller device; a control that appears as a button on a larger device may appear as a link or other control on a smaller device. You need access to the sort of setup that a developer will use to create and configure online applications, which means a larger tablet, notebook, or, better yet, a full desktop system. The various people who worked on this book used desktop systems running the Windows, Linux, and Mac OS X platforms and using a number of common browsers.

Because this is a book about application development, you also need to have some understanding of the development process. Knowledge of Python would be nice, but it’s not absolutely necessary because of the way the examples work. You may still need to spend some time with a Python tutorial to understand everything that the examples provide. In addition, you need to know how to work at the command prompt or terminal window. Many of the examples require that you manually type commands rather than work with a GUI. In fact, a few of the examples simply won’t work with a GUI because the options are unavailable. (These examples are clearly marked in the book.)

Icons Used in This Book

As you read this book, you encounter icons in the margins that indicate material of special interest (or not, as the case may be!). Here’s what the icons mean:

tip Tips are nice because they help you save time or perform some task without a lot of extra work. The tips in this book are time-saving techniques or pointers to resources that you should try so that you can get the maximum benefit when performing AWS-related tasks.

warning I don’t want to sound like an angry parent or some kind of maniac, but you should avoid doing anything that’s marked with a Warning icon. Otherwise, you might find that your configuration fails to work as expected, you get incorrect results from seemingly bulletproof processes, or (in the worst-case scenario) you lose data.

technicalstuff Whenever you see this icon, think advanced tip or technique. You might find these tidbits of useful information just too boring for words, or they could contain the solution you need to get an AWS service running. Skip these bits of information whenever you like.

remember If you don’t get anything else out of a particular chapter or section, remember the material marked by this icon. This text usually contains an essential process or a bit of information that you must know to work with AWS, or to perform cloud-based-setup tasks successfully.

Beyond the Book

This book isn’t the end of your AWS learning experience — it’s really just the beginning. I provide online content to make this book more flexible and better able to meet your needs. That way, as I receive email from you, I can address questions and tell you how updates to AWS or its associated add-ons affect book content. In fact, you gain access to these cool additions:

Where to Go from Here

It’s time to start your AWS adventure! If you’re completely new to AWS, you should start with Chapter 1 and progress through the book at a pace that allows you to absorb as much of the material as possible. Chapter 2 is especially important because it helps you understand what Amazon means by free-tier services. You should also read Chapter 3, even if you have experience with AWS, because it provides information about the services discussed in the book.

Readers who have some exposure to AWS must still work through the latter half of Chapter 2 because it shows how to obtain your developer key. After that, you can move directly to Chapter 4. You can always go back to earlier chapters as necessary when you have questions. However, you do need to understand how each technique works before moving to the next one. Every technique and procedure has important lessons for you, and you can miss vital content if you start skipping too much information.

Part 1

Discovering the AWS Development Environment

IN THIS PART …

Get started with Amazon Web Services (AWS).

Create a good AWS development environment.

Obtain your developer key.

Understand the AWS free tier.

Consider the security issues.

Chapter 1

Starting Your AWS Adventure

IN THIS CHAPTER

check Exploring the AWS cloud

check Considering Infrastructure as a Service (IaaS)

check Defining when, why, and how to use AWS

check Ensuring you have a supported platform

There was a time when business development meant creating software for a single machine or for a workgroup. The client-server architecture, with its emphasis on both local and centralized servers, came next. Developers eventually started creating applications for the Internet as well, enabling people to do things like work from home without losing contact with the organization’s database. Browser-based applications actually appear on most desktops today, and you might spend much of your nondevelopment time using one.

As development has moved onward and outward, the tools, techniques, and processes for development have changed as well. Today you deal with the cloud, where the server that holds your application doesn’t even reside on the premises. In many respects, everyone is a remote user today. Of course, organizations have a huge investment in existing hardware and software, so you’re actually more likely to find yourself working in a hybrid environment with one foot on local resources and the other on someone else’s turf. Amazon Web Services (AWS) provides you with a complete development environment, but for many developers, the changes that using AWS require are significant and awkward. This chapter helps you better understand what to expect from AWS and to feel just a little less awkward about the coming changes.

You may also find yourself drowning in a sea of new abbreviations and acronyms. Of course, you can act like you know what all these terms mean, but they’re actually important terms, and knowing what they mean gives you an edge over everyone else. This chapter also helps you understand terms like Infrastructure as a Service (IaaS) and discover just what this new term means to you as a developer. If you already work on the Internet, you could possibly skip this part of the chapter, but if you’ve spent your career working with desktop applications or a local intranet, you definitely want to find out more.

Developers often find that the most frustrating part of creating an application is having the right tool. Development is more than knowing the right procedures and the right function calls — it’s a matter of knowing the most efficient manner in which to use them and determining when the tools already in use won’t do the job. This chapter closes with some essential information about the platforms that AWS supports. Reading this material will help you avoid some serious trouble later because you can avoid the most serious platform issues at the outset.

Defining the AWS Cloud

As a developer, you need to meet end-user demands with the least amount of effort and in the quickest time. Amazon Web Services (AWS) is a huge array of services that affects consumers, small to medium-sized businesses (SMB), and enterprises. Using AWS, you can do everything from creating applications for remote access to organization data to creating a full-fledged IT department in the cloud. The installed base is immense. You can find case studies of companies like Adobe and Netflix that use AWS at https://aws.amazon.com/solutions/case-studies/. (The page also includes a link to create an account, a topic discussed in Chapter 2.) AWS use isn’t just for private companies, either — even the government makes use of its services.

The technologies that make all these services possible are simple in conception. Think of a pair of tin cans attached to each other by a string. Amazon holds one tin can and you hold the other. By talking into one tin can, you can hear what is said at the other end. The implementation, however, relies on details that make communication harder than you might initially think. The following sections give you an overview on how the AWS cloud works.

Understanding service-driven application architectures

Service-driven application architectures, sometimes known as Service-Oriented Architectures (SOA), come in many forms. No matter how you view them, service-driven application architectures are extensions of the client-server technologies that you may still use when creating localized applications, in that a client makes a request that a server fulfills by performing an action or sending a response.

The request/response implementation details have changed significantly over the years, however, making modern applications far more reliable, flexible, and less reliant on a specific network configuration. The request and response process can involve multiple levels of granularity, with the term microservice applied to the smallest request and response pairs. Developers often refer to an application that relies on a service-driven application architecture as a composite application because it exists as multiple pieces glued together to form a whole. Service-driven application architectures follow many specific patterns, but in general, they use the following sequence to perform communication tasks:

  1. Create a request on the client using whatever message technology the server requires.
  2. Package the request, adding security or other information as needed.
  3. Send the request using a protocol, such as Simple Object Access Protocol (SOAP), or an architecture, such as REpresentational State Transfer (REST).

    tip No matter what programming language you use, you need to know how to communicate with web services using your programming language of choice. The “Considering the AWS-Supported Platforms” section of this chapter helps you make a good decision about a language choice. You can discover how SOAP works at http://www.w3schools.com/xml/xml:soap.asp and how REST works at http://www.tutorialspoint.com/restful/. Knowledge of both is required when working with AWS as a developer.

  4. Process the request on the server.
  5. Perform an action or return data as required by the request.
  6. When working with data, process the response on the client and present the results to the user (or other recipient).

remember AWS provides a service-driven application architecture in which you choose a specific service, such as Simple Storage Service (S3), to perform specific tasks, such as to store application data in a remote location. In many cases, you must perform setup steps in addition to simply interacting with the service. For example, if you look at the ten-minute tutorial at http://aws.amazon.com/getting-started/tutorials/backup-files-to-amazon-s3/, you find that you must first create a bucket to store the files you want to upload to Amazon. This additional step makes sense because you have to establish a location from which to retrieve the files later, and you don’t want your files mixed in with files from other people.

Even though many of the processes you perform with AWS require using an app (so that you have a user interface rather than code to work with), the underlying process is the same. The code provided in the app makes requests and then waits for a response. In some cases, the app must determine the success or failure of an action on the server. Rather than reinvent the wheel, a smart developer will use as many of these apps as possible to perform general configuration tasks. Using the AWS apps places the burden of updating the code on Amazon so that you can focus on custom tasks related to your organization.

Understanding process- and function-driven work flows

In creating apps to help manage underlying services, AWS also defines workflows. A workflow is an organized method of accomplishing tasks. For example, when you want to save a file to AWS using S3, you must first create a bucket to hold the file. Only after you create a bucket can you save a file to AWS. In addition, you can’t retrieve a file from the bucket until you first save a file there, which makes sense because you can’t grab a file out of thin air. In short, a workflow defines a procedure for working with software, and the concept has been around for a long time. (The first workflows appeared in the mid-1970s with simple office automation prototypes at Xerox Parc and the University of Pennsylvania’s Wharton School of Business.)

Workflows can consist of additional workflows. In addition, workflows manage the interaction between users and underlying services. A process is the aggregation of services managed by workflows into a cohesive whole. The workflows may perform generic tasks, but processes tend to be specific and help users accomplish particular goals. A process-driven workflow is proactive and attempts to circumvent potential problems by

  • Spotting failure patterns and acting on them
  • Looking for trends that tend to lead to failures
  • Locating and extinguishing potential threats

tip In looking through the tutorials at http://aws.amazon.com/getting-started/tutorials/, you find that they all involve using some type of user interface. The user interface provides the workflow used to manage the underlying services. Each major tutorial step is a workflow that performs a specific task, such as creating a bucket. When you combine these individual workflows into an aggregate, the process can help a user perform tasks such as moving files between the cloud and the user’s system. Creating a cloud file system is an example of a process-driven workflow: The workflow exists to make the process viable. Workflows can become quite complex in large-scale operations, but viewing them helps you understand AWS better. You can find a more detailed discussion of workflows and processes at https://msdn.microsoft.com/library/bb833024.aspx.

A function is the reactive use of services managed by workflows to address specific problems in real time. Even though it would be nice if process-driven workflows worked all the time, the reality is that even with 99.999 percent reliability, the process will fail at some point, and a function-driven workflow must be in place to address that failure. Although process-driven workflows focus on flexible completion of tasks, function-driven workflows focus on procedurally attenuating the effect of a failure. In short, function-driven workflows address needs. The AWS services and workflows also deal with this issue through the user interface, such as by manually restoring a backup to mitigate a system failure.

remember As a developer, you find yourself involved in a number of tasks that may appear at first to fall outside the realm of development. Development in the cloud isn’t quite the same as development at the desktop or development of applications using a browser strategy. When working through development tasks with AWS, you find yourself performing these kinds of tasks in order to implement workflows:

  • Configuring the native functionality of AWS using wizards, AWS-driven scripts, or direct API calls through code
  • Modifying AWS-driven scripts as needed to accomplish specific goals in the least amount of time possible
  • Defining new configuration scenarios to meet workflow requirements by modifying underlying AWS configuration files, scripts, and code
  • Using AWS-supplied tools, such as lambda functions (see https://aws.amazon.com/lambda/), to perform tasks without resorting to hard coding
  • Developing applications that rely on API calls to perform tasks

Discovering IaaS

Even though this book frequently refers to virtual environments and services that you can’t physically see, these elements all exist as part of a real computer environment that Amazon hosts on your behalf. You need to understand how these elements work to some extent because they have a physical presence and impact on your personal or business needs. Three technologies enable anyone to create a virtual computer center using AWS:

The following sections provide an extended discussion of these three technologies and help you understand how they interact with each other. The point of these sections is that each element performs a different task, yet you need all three to create a complete solution.

Defining IaaS

The simplest way to view IaaS is as a means of providing access to virtualized computer resources over an Internet connection. IaaS acts as one of three methods of sharing resources over the Internet, alongside SaaS and PaaS. AWS supports IaaS by providing access to virtualized hardware, software, servers, storage, and other infrastructure components. In short, you can use IaaS to replace every physical element in your computing setup except those required to establish and maintain Internet connectivity and those required to provide nonvirtualized services (such as printing). The advantages of IaaS are many, but here are the ones that most people consider essential:

  • The host handles tasks such as system maintenance, backup, and resiliency planning.
  • A client can gain immediate access to additional resources when needed and then doesn’t need to worry about getting rid of them when the need has ended.
  • Detailed administrative tasks are handled by the host, but the client can manage overall administrative tasks, such as deciding how much capacity to use for a particular task.
  • Users have access to desktop virtualization, which means that their desktop appears on whatever device they happen to use at a given moment.
  • The use of policy-based services ensures that users must still adhere to company requirements when using computer resources.
  • All required updates (software and hardware) occur automatically and without any interaction required by the client.
  • warning Keep in mind that there is no free lunch. AWS and other IaaS providers are interested in making a profit. They do so by investing in huge quantities of hardware, software, and management personnel to oversee it all. The benefits of scale help create profit, and many businesses simply can’t create the setups they require for less money. However, you must consider the definite disadvantages of IaaS as well:

  • Billing can become complex because some services are billed at different rates and within different time frames. In addition, billing can include resource usage. The client must ensure that the amount on the bill actually matches real-world usage; paying too much for services that the client didn’t actually use can easily happen.
  • Systems-management monitoring becomes more difficult. The client loses control over the precise manner in which activities occur.
  • A lag often occurs between when a change in service is needed and when the host provides it, so the client can find that even though services are more flexible, they aren’t as responsive.
  • Host downtime can affect a large group of people and prove difficult to fix, which means that a particular client may experience downtime at the worst possible time without any means to resolve it.
  • Building and testing custom applications can become more difficult. Many experts recommend using in-house equipment for application-development needs to ensure that the environment is both protected and responsive.

remember IaaS service contracts vary a great deal between vendors. Even though this book focuses on AWS, you need to consider other offerings, including Windows Azure, Google Compute Engine, Rackspace Open Cloud, and IBM SmartCloud Enterprise. In some cases, you might actually find it useful to obtain services from multiple hosts to obtain the best service for a particular need.

Comparing IaaS to SaaS

SaaS is all about cloud-based applications. Products like online email and office suites are examples of cloud-based applications. A client typically accesses the application using a local application, such as a browser. The browser runs on local hardware, but the application runs on the host hardware. What a client sees is the application running in the browser as if it is working locally. In most cases, the application runs within a browser without any alteration to the local system. However, some applications do require the addition of plug-ins.

The difference between IaaS and SaaS is the level of service. When working with IaaS, a client typically requires detailed support that spans entire solutions. A SaaS solution may include only the application. However, it can also include the following:

  • Application runtimes
  • Data access
  • Middleware
  • Operating system support
  • Virtualization
  • Server access
  • Data storage
  • Networking

remember SaaS typically keeps the host completely in control and doesn’t offer any sort of monitoring. Even though the host keeps the application updated and ensures data security, the client company administrators typically can’t access SaaS solutions in any meaningful way. (SaaS offers application usage, but not necessarily application configuration, and is therefore not as flexible as other alternatives.) In addition, the client company typically accepts the application as is, without any modifications or customizations. Using client-developed applications is out of the question in this scenario.

Comparing IaaS to PaaS

PaaS is more of a development solution than a production environment solution. A development team typically uses PaaS to create custom solutions or modify existing solutions. The development staff has full control over the application and can perform all development-related tasks, such as debugging and testing. As with the SaaS solution, the host normally maintains control over

  • Middleware
  • Operating system support
  • Virtualization
  • Server access
  • Data storage
  • Networking

In this case, however, the development staff can access the middleware to enhance application development without reinventing the wheel. Writing application code to make the application cloud-ready isn’t necessary because the middleware already contains these features. The development team gains access to cloud-based application features that include the following:

  • Scalability
  • High availability
  • Multitenancy
  • SaaS enablement

remember Administrators can also perform monitoring and management tasks within limits when working with a PaaS (depending on the contract the client has with the host). However, realize that PaaS is oriented toward development needs, so the developer takes precedence when it comes to performing some tasks that an administrator might normally perform. In addition, PaaS relates to development, not production setups, so the host may take care of all administration tasks locally.