Chapter 2

Obtaining Development Access to Amazon Web Services

IN THIS CHAPTER

check Considering the limits of the free services of AWS

check Knowing what hardware you need to work with AWS

check Obtaining your AWS developer account

check Checking your setup

As a developer, you need some knowledge of administration tasks on Amazon Web Services (AWS) before you can do much else. The reason is that you need to set up and configure some test scenarios to work with when performing development tasks. Obviously, you don’t want to ruin a perfectly good production setup by using untested code. Discovering how AWS works is much easier if you have your own account and resources to work with. Of course, you don’t want to have to pay for the learning time, which is why the first section of this chapter discusses the free services that AWS has to offer, and there are a lot of them. Unfortunately, free resources don’t always remain free, and sometimes free is an illusion, so the chapter discusses these issues as well.

Development also means having some amount of hardware available for the task. In this case, you actually need several levels of hardware:

  • User: To even start working with your computer, you have basic user needs to meet. This chapter assumes that you have the hardware required to run the user environment for your system. Because you could end up simulating more than one user, you may want to ensure that your system well exceeds the requirements for a single user, even when you plan to perform simulations through task switching (placing one user in hibernation while you act as another).
  • Network: You require a connection to the Internet and any local network resources needed to develop your application. This chapter doesn’t cover any of these requirements. However, given that you plan to perform development tasks over the network, you may need to talk with your network administrator to ensure that you have proper rights and any additional hardware required to allow the bandwidth required to work with AWS.
  • Development: The programming language you choose will have certain hardware requirements, as will any developer add-ons you require. This chapter assumes that you know what these requirements are for your particular setup. You must plan this hardware in addition to any other hardware required for other purposes.
  • AWS: Interestingly enough, your AWS setup also requires hardware. This chapter discusses the hardware you typically want to have to ensure that AWS works properly. This hardware is in addition to the hardware you need to run your user, networking, and development environment.

To work as an AWS developer, you actually need two levels of AWS access. The first level of access provides an account that you use to set up and configure services such as Amazon Simple Storage Service (S3). The second level of access is your developer account, which includes obtaining a development key that you use to access AWS through code. This chapter helps you obtain both levels of access.

The final section of the chapter helps you test your setup. You perform the same tasks that you perform when developing an application, but a short version of them. In this case, you perform a quick S3 setup, test it, and then access it using scripted code. The idea is to ensure that you actually can access AWS as you work through the examples later in the book.

Discovering the Limits of Free Services

Amazon does provide the means for using many of its cloud services for free. In fact, you can see some of these services at http://aws.amazon.com/free/. However, as you look through the list of services, you see that some expire but others don’t. In addition, some have limits and others don’t. Those that do have limits don’t have the same limits, so you need to watch usage carefully. It’s really quite confusing. The following sections help clarify what Amazon actually means by saying some services are free.

Expiring services versus non-expiring services

Many of the AWS services you obtain through the free tier have expiration dates, and you need to consider this limitation when evaluating and possibly using the service to perform useful work. Figure 2-1 shows examples of services with an expiration date. Notice that you must begin paying for the service 12 months after you begin using it.

image

FIGURE 2-1: Some services have an expiration date when you must begin paying for it.

In some cases, the product itself doesn’t have an expiration date, but the service on which it runs does. For example, when viewing the terms for using the free software, the software itself is indeed free. However, to run the software, you must have the required service, which does come with an expiration date (see Figure 2-2). In this case, the Amazon Mobile Analytics depend on Amazon S3 (listed near the bottom of the description). You have access to 100 million events per month free, but in order to export your event data, you need S3, which has an expiration date. Notice also that after you reach the 100 million events level, you must pay an additional amount for each additional million events, so free doesn’t necessarily remain free.

image

FIGURE 2-2: Software may be free, but the service on which it runs might not be.

You also have access to some products that are both free and have no expiration date. These nonexpiring offers still have limitations (and often caveats), but you don’t have to worry about using those products within the limits for however long you want (or until Amazon changes the terms). Figure 2-3 shows an example of this kind of service. Notice that the service is free, doesn’t expire, and doesn’t depend on a service that expires. However, you must pay for both throughput and storage, so a cost is still involved.

image

FIGURE 2-3: A few services don’t come with expiration dates.

remember Knowing the terms under which you use a service is essential. The free period for services with an expiration date goes all too quickly, and you may suddenly find yourself paying for something that you thought remained free for a longer time frame. Given that Amazon can change the terms of usage at any time, you need to keep checking the terms of service for the services that you use. A service that lacks an expiration date today may have an expiration date tomorrow.

Considering the usage limits

Look again at Figures 2-1 through 2-3. Note that all these products have some sort of usage limit attached to them — even the free software — because of the software’s reliance on an underlying service. (Some software relies on more than one service, so you must also consider this need.) For example, you can use Amazon Elastic Compute Cloud (EC2) for 750 hours per month as either a Linux or Windows setup. A 31-day month contains 744 hours, so you really don’t have much leeway if you want to use the EC2 service continuously.

warning The description then provides an example of usage. Amazon bases the usage terms on instances. Consequently, you have access to a single Linux or single Windows setup. If you wanted to work with both Linux and Windows, you would need two instances and could use them for only 15 days and 15 hours each month. In short, you need to exercise care in how you set up and configure the services to ensure that you don’t exceed the usage limits.

The free, nonexpiring services also have limits. For example, when working with Amazon DynamoDB, you have access to 25GB of storage, 25 units of read capacity, and 25 units of write capacity (see Figure 2-4 for details). Theoretically, this is enough capacity to handle 200 million requests each month. However, whether you can actually use all that capacity depends on the size of the requests and how you interact with the service. You could easily run out of storage capacity long before you run out of request capacity when working with larger files, such as graphics. Again, you need to watch all the limits carefully or you could find yourself paying for a service that you thought was free.

image

FIGURE 2-4: Verify the free-tier usage details for a service before you commit to using it.

Considering the Hardware Requirements

No matter how many services AWS offers, you still require some amount of hardware to use the services. The amount of hardware you require when working with services in the cloud is minimal because the AWS hardware does all the heavy lifting. When working with services locally, you need additional hardware because AWS is no longer doing the heavy lifting for you. Therefore, you should consider different hardware requirements depending on where you host the AWS service. The following sections help you obtain additional information about working with both cloud and local services.

Hosting the services locally

Hidden in the AWS documentation is all sorts of useful information about various services. For example, AWS Storage Gateway (http://aws.amazon.com/documentation/storage-gateway/) will connect an on-premises software appliance (an application combined with just enough operating system capability to run on hardware or on a virtual machine) with cloud-based storage. In other words, you use the gateway to connect your application to the data storage it requires. It might seem as if running the gateway in the cloud would be a good idea because you wouldn’t need to invest in additional hardware. However, when you look at the requirements shown in Figure 2-5, you see that the AWS Storage Gateway comes with specific hardware, instance, and storage requirements. (Only the hardware requirements appear in Figure 2-5.) The important thing to understand is that the cloud presents limits that you must consider during any planning stage.

image

FIGURE 2-5: Using cloud-based services can come with limitations.

After you make certain that you can run your intended configuration, you can begin to consider the advantages and disadvantages of working in the cloud. For example, when hosting the service in the cloud, you get automatic scaling as needed, and Amazon performs many of the administrative tasks for you. Chapter 1 discusses many of the advantages of the cloud. However, for a realistic perspective, you must offset these advantages with awareness of the disadvantages, such as:

  • Potential for lower application speed
  • Need to maintain a reliable Internet connection
  • Loss of flexibility
  • Vendors going out of business

Even though basic hardware needs become less expensive, you do need to consider additional expenses in the form of redundancies. Most organizations find that the hardware costs of moving to the cloud are substantially less than maintaining a full IT department, which is why they make the move. However, you must make the move with the understanding that you have other matters to consider when you do.

Hosting the services in the cloud

When hosting services locally, you need to provide all the required infrastructure, which can get expensive. AWS does provide guidance on the minimum requirements for hosting a service locally. For example, Figure 2-5 shows the requirements for the AWS Storage Gateway.

tip A good rule of thumb when hosting services locally is to view any vendor-supplied requirements as minimums. If you don’t plan to load the service heavily, these minimums usually work. However, when you click the Optimizing Gateway Performance link, the first suggestion you see is to add resources to your gateway, as shown in Figure 2-6. Planning for too much capacity is better than for not enough, but getting the configuration as close as possible to what you need will always help financially.

image

FIGURE 2-6: Plan ahead for sufficient resources.

Not all the services will work locally, but you may be surprised to find that many do. The issue is one of defining precisely how you plan to use a given service and the trade-offs that you’re willing to make. For example, when hosting a service locally, you may find it hard to provide the same level of connectivity that you could provide to third parties when hosting the same service in the cloud.

Defining a good development environment

After you know about the resources required for AWS and have accounted for the basics of your setup, you need to consider your development environment. The first issue you must consider is one of language. AWS doesn’t care what IDE you use (although the choice of IDE determines which features you have available for remote access), but it does care about language. You must verify that AWS supports the language of your choice for the service you want to access. For example, Figure 2-7 shows the choices for Simple Queue Service (SQS).

image

FIGURE 2-7: Make certain that AWS provides support for the language you want to use.

You can create a deployment environment using EC2. The tutorial at http://docs.aws.amazon.com/cli/latest/userguide/tutorial-ec2-ubuntu.html describes how to perform this task. The main advantage of this approach is that you can theoretically develop AWS applications from anywhere because development no longer requires a local system with specific resources. However, this approach is most definitely not free, and it means that you must have a reliable Internet connection from wherever you want to perform development tasks — which is not a problem at work, but possibly an issue at home. The cloud-based development approach uses the AWS Command Line Interface (CLI), which is a tool you begin using in the “Installing the Command Line Interface Software” section of Chapter 5.

The main reason to use a localized development environment is that you retain access to local resources and the code libraries that your organization currently relies on to perform development tasks. This option also has an advantage in reliability because you don’t rely on a remote connection to use it. If your Internet connection goes down, you can continue developing code (but testing isn’t possible until the connection is restored). When using this option, you do need additional bandwidth — at least for testing purposes and permissions for the AWS access through the organization’s firewall.

tip You aren’t limited to just two options when working with AWS. For example, you could use a local development environment but place your code on S3. The use of cloud-based data storage means that you can have localized setups in several locations (so that you retain access to local resources) and still gain advantages of cloud-based development, such as having access to your code from any location where you have a development environment configured. The tutorial at http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/chapter-devenv.html is also interesting because it tells you how to configure your development environment to use Elastic Beanstalk for project, source control, and repository use. As with a localized development environment, you still need required permissions for Internet access and enough bandwidth to handle the increase in data requests to make this option work well. In fact, the bandwidth requirements are higher than a local configuration, and the development environment must work with remote resources.

Choosing the correct development environment isn’t easy, as described by articles such as the one at https://blog.rackspace.com/the-case-for-using-aws-for-development-environments. In many cases, the choice becomes one of personal preference and organizational requirements. For example, using a cloud-based development solution might not be an option when dealing with sensitive development tasks; security needs could trump other wants.

Getting Signed Up

The sign-up process lets you interact with AWS. To use AWS, you must have two levels of access:

  • User: The first level grants you user-level access to the various services. Even though this book doesn’t provide you with an in-depth view of these services, knowing how to use them is a plus. AWS does provide tutorials to help you out, but you may also want to obtain AWS For Admins For Dummies, by John Paul Mueller (Wiley), for more detailed information on the services you can use for free to keep your learning curve costs to a minimum.
  • Developer: The second level, which you must obtain after getting user-level access, is developer access. Amazon wants to know who is using its service for a number of reasons, including billing, which means you need a developer ID to obtain the required programmatic access to services.

With these requirements in mind, the following sections help you get signed up so that you can start using AWS.

Obtaining an account

Before you can really do anything other than plan, you need an account. Discovering the wonders of AWS is a hands-on activity, so you really do want to work with it online. Consequently, this book assumes that you’ve gone through the free sign-up process described in the following steps:

  1. Navigate your browser to http://aws.amazon.com/.

    The main Amazon Web Services page appears.

  2. Click Create a Free Account.

    Unless you already signed into Amazon, you see a Sign In or Create an AWS Account dialog box like the one shown in Figure 2-8. If you already have an Amazon account and want that account associated with AWS, you can sign in using your Amazon account. Otherwise, you need to create a new account.

  3. Sign into an account or create a new one as required.

    The Contact Information page appears, as shown in Figure 2-9. Notice that different pages exist for company and personal accounts.

  4. Supply the required company or personal contact information. Read and accept the customer agreement.
  5. Click Create Account and Continue when you complete the form.

    You see the Payment Information page, shown in Figure 2-10. Be aware that Amazon will bill you for any usage in excess of the free-tier level. Click View Full Offer Details if you have any questions about the level of support provided before you enter your credit or debit card information.

  6. Provide the required credit or debit card information, supply the address information needed, and then click Continue.

    You see the Identify Verification page, shown in Figure 2-11. Amazon performs an automated call to verify your identity. You see a PIN provided onscreen. During the call, you say or type this PIN into your telephone keypad. The screen automatically changes as you perform each step of the identification process.

  7. Click Continue to Select Your Support Plan.

    You see a listing of support plans, as shown in Figure 2-12. Only the Basic plan is included as part of the free tier. If you want to obtain additional support, you must pay a monthly fee for it. This is an example of one of the potential charges that you might pay for the free-tier service. You have the following support-plan options:

    • Basic: Free support that Amazon offers as part of the free-tier support. Amazon doesn’t offer any support through this option. You must instead rely on community support, which usually works fine for experimentation.
    • Developer: Support that comes at $29/month at the time of this writing. A single developer (or other organizational representative) can contact the Support Center and expect a response within 12 to 24 hours. However, if you’re serious about developing an application and anticipate using third-party products, you really need to consider the Business level.
    • Business: Support that comes at $100/month at the time of this writing. A business user may contact the Support Center by phone and expect a one-hour response to urgent support problems as well as obtain help with third-party products.
    • Enterprise: Support that comes at $15,000/month. This is the level of support provided for organizations that use AWS for mission-critical applications. The response time is only 15 minutes, and Amazon is willing to provide all sorts of technical help. Of course, the price is a tad on the steep side.
  8. Choose a support plan and click Continue.

    Normally, you see a welcome page like the one shown in Figure 2-13. (However, you might also see a message saying that Amazon is setting up your account and will send you emails when your account is ready. Wait for the emails to arrive if you see these messages.) At this point, you can sign into the console and try a few tasks. The ten-minute tutorials are helpful in getting you started. The next section of the chapter gives you help getting started as well.

image

FIGURE 2-8: Sign into or create an Amazon account.

image

FIGURE 2-9: Supply the required contact information for the kind of account you want.

image

FIGURE 2-10: Provide a credit or debit card to use as payment.

image

FIGURE 2-11: Supply the information needed to verify your identity.

image

FIGURE 2-12: Select the level of support needed for your AWS use.

image

FIGURE 2-13: Start using AWS to perform useful tasks.

Getting access keys

You use access keys with API calls to allow the call to proceed. Without an access key, AWS rejects any requests made. Access keys come in two parts: public and secret. To safeguard your setup, the private key must remain private. During the creation process, you download both keys. Make sure you keep them in a safe place.

remember The following steps help you create the access keys you need to work with the examples in the book. You can’t use any of the coded examples without an access key. The access key found in the book’s code is an example key. It won’t return a usable result.

  1. Navigate your browser to https://console.aws.amazon.com/iam/.

    You see the Identity and Access Management (IAM) Console, shown in Figure 2-14.

  2. Click Groups in the Navigation pane.

    You see an option for creating a new group, as shown in Figure 2-15.

  3. Click Create New Group.

    AWS asks you to provide a group name.

  4. Type a group name (the book uses Developers) and click Next Step.

    AWS asks you to attach a policy to the group, as shown in Figure 2-16. Normally you choose a policy that provides just the level of access required by that group. For the purposes of this book, because you spend time exploring much of AWS, you choose a more encompassing policy. However, when working in a production environment, remember to use policies carefully.

  5. Select AdministratorAccess and click Next Step.

    You see a Review page where you can review the group’s settings.

  6. Click Create Group.

    The group is now ready for use. You see it in the Groups tab of the IAM Console. However, you still need to create a user account to obtain the required access keys.

  7. Select Users in the Navigation pane.

    You see the Users tab of the IAM Console, shown in Figure 2-17.

  8. Click Add User.

    AWS asks you to provide a username, as shown in Figure 2-18. Note that this page also provides the means for configuring the kind of user access.

  9. Type a username (the book uses John).

    AWS lets you add more than one user at a time, as long as both users have the same requirements.

  10. Select both Access Type entries.

    You require both access types to interact with the examples in the book.

  11. Configure the password settings for the user you want to create.

    The default is to autogenerate a password and then require the user to change it during the next login. Because you want to create an account for yourself, you can save time by creating a custom password and deselecting the option that requires the user to change the password during the next login.

  12. Click Next: Permissions.

    AWS asks you to set permission for the user, as shown in Figure 2-19.

  13. Choose Add User to Group and then select the Developers entry in the list of groups shown.
  14. Click Next: Review.

    AWS shows you the configuration for your user.

  15. Click Create User.

    AWS generates the user and the user’s access key.

  16. Click Download .CSV.

    Your browser downloads a .CSV file containing the public and secret keys for your user account. Keep these keys in a safe location.

image

FIGURE 2-14: Use the IAM Console to create your access keys.

image

FIGURE 2-15: The Groups tab of the IAM Console lets you manage groups.

image

FIGURE 2-16: Choose a policy for the group you create.

image

FIGURE 2-17: The Users tab of the IAM Console lets you manage users.

image

FIGURE 2-18: Create a username and access type.

image

FIGURE 2-19: Set the user permissions.

technicalstuff You can create new access keys as needed by accessing the user’s entry on the Users tab of the IAM Console and choosing the Security Credentials tab of the individual user’s account. The Security Credentials tab contains a Create Access Key in the Access Keys area. Every time you create a new access key, you have the option of downloading a .CSV file containing the public and secret keys. To remove an existing key, click the X next to that key’s entry on the Security Credentials tab.

Testing Your Setup

Now that you have a free account to use, you can give something a try. In this case, you create an online storage area, move a file to it, copy the file back to your hard drive, and then delete the file in the online storage. Moving data between local drives and the AWS cloud is one of the most common activities you perform, so this exercise is important, even if it seems a bit simplistic. The following steps help you through the process of working with files in the cloud:

  1. Click Sign in to the Console or choose My Account ⇒   AWS Management Console.

    You see a sign-in page similar to the one shown in Figure 2-8, even if you just completed the sign-up process.

  2. Sign in to your account.

    You see an AWS Services page like the one shown in Figure 2-20.

  3. Select S3 from the Services dropdown at the top of the page.

    You see an introduction to the Sample Storage Service (S3) page. This page explains a little about S3. Make sure to read the text before you proceed.

    To use S3, you must first create a bucket. The bucket will hold the data that you transfer to AWS. In this case, you use the bucket to hold a file.

  4. Click Create Bucket.

    You see the Create a Bucket dialog box, shown in Figure 2-21. The Bucket Name field contains the name that you want to give to your bucket. Choose a name that seems appropriate for the bucket’s use. (See the bucket naming restrictions at http://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html). The Region field tells where your bucket is physically stored. A local bucket will respond faster, but a bucket somewhere else in the world may provide additional resilience because it won’t be as susceptible to local events, such as storms.

  5. Type a bucket name (the example uses aws4d.test-bucket) and select a region (the example uses Oregon); then click Create.

    You see a new page with a list of all your buckets, as shown in Figure 2-22. You can configure each bucket differently using the properties shown on the right side of the screen. For now, use the default properties to work with a file.

  6. Click the bucket entry you just created.

    You see a console for that bucket that tells you the bucket is empty.

  7. Click Upload.

    You see an Upload – Select Files and Folders dialog box.

  8. Click Add Files.

    You see a File Upload dialog box that will conform to the standard used for your platform.

  9. Select the file you want to upload (the example uses the outline for this book) and click Open.

    The Upload – Select Files and Folders dialog box now contains a list of the files you plan to upload, as shown in Figure 2-23.

  10. Click Start Upload.

    The file is added to your bucket, as shown in Figure 2-24.

  11. Select the box next to the file you uploaded.

    Depending on the browser’s capabilities, you can open the file for viewing or editing, or simply download it to your system.

  12. Choose Actions ⇒   Delete.

    You see a dialog box asking whether you want to delete the file.

  13. Click OK.

    S3 deletes the file. Your bucket is now empty again.

    Congratulations! You have now used S3 to perform the first set of tasks for the book.

  14. Choose <Your Name> ⇒   Sign Out.

    AWS logs you out of the console. Logging out when you finish a session is always a good idea.

image

FIGURE 2-20: The console provides access to all the services you can use.

image

FIGURE 2-21: Define a name and region for your bucket.

image

FIGURE 2-22: S3 provides a listing of the buckets you created.

image

FIGURE 2-23: You can see a list of the files you plan to upload to S3.

image

FIGURE 2-24: The file now appears in your bucket.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset