AWS SDK for PHP

download AWS SDK for PHP

of 35

  • date post

    08-Dec-2016
  • Category

    Documents

  • view

    223
  • download

    0

Embed Size (px)

Transcript of AWS SDK for PHP

  • AWS SDK for PHPDeveloper Guide

    Version v1.0.0

  • AWS SDK for PHP: Developer GuideCopyright 2013 Amazon Web Services, Inc. and/or its affiliates. All rights reserved.

    The following are trademarks of Amazon Web Services, Inc.: Amazon, Amazon Web Services Design, AWS, Amazon CloudFront,Cloudfront, Amazon DevPay, DynamoDB, ElastiCache, Amazon EC2, Amazon Elastic Compute Cloud, Amazon Glacier, Kindle, KindleFire, AWS Marketplace Design, Mechanical Turk, Amazon Redshift, Amazon Route 53, Amazon S3, Amazon VPC. In addition,Amazon.com graphics, logos, page headers, button icons, scripts, and service names are trademarks, or trade dress of Amazon inthe U.S. and/or other countries. Amazon's trademarks and trade dress may not be used in connection with any product or service thatis not Amazon's, in any manner that is likely to cause confusion among customers, or in any manner that disparages or discreditsAmazon.

    All other trademarks not owned by Amazon are the property of their respective owners, who may or may not be affiliated with, connectedto, or sponsored by Amazon.

    AWS SDK for PHP Developer Guide

  • AWS SDK for PHP Developer Guide ...................................................................................................... 1Getting Started ....................................................................................................................................... 4AWS Region Selection ........................................................................................................................... 8Using IAM Roles for EC2 Instances with the AWS SDK for PHP ........................................................ 10Tutorial: Amazon EC2 Spot Instances .................................................................................................. 17Start an Amazon EC2 Instance ............................................................................................................ 26Create an Amazon EC2 Client .............................................................................................................. 26Create a Security Group ....................................................................................................................... 27Authorize Security Group Ingress ......................................................................................................... 28Create a Key Pair .................................................................................................................................. 29Run an Amazon EC2 Instance ............................................................................................................. 29Connect to Your Amazon EC2 Instance ................................................................................................ 30Related Resources ............................................................................................................................... 30Further Resources ................................................................................................................................ 31Document History ................................................................................................................................. 32

    Version v1.0.03

    AWS SDK for PHP Developer Guide

  • AWS SDK for PHP Developer Guide

    IMPORTANT DEPRECATION NOTICEThis version of the AWS SDK for PHP is deprecated and is provided only to support legacy applications.All new code should use the current version of the SDK at http://aws.amazon.com/sdkforphp/.

    About the AWS SDK for PHPThe AWS SDK for PHP provides a PHP API for AWS infrastructure services. Using the SDK, you canbuild applications on top of Amazon Simple Storage Service (Amazon S3), Amazon Elastic ComputeCloud (Amazon EC2), Amazon SimpleDB, and more.

    The AWS SDK for PHP includes:

    AWS PHP LibraryBuild PHP applications on top of APIs that take the complexity out of coding directly against a webservice interface. The library provides APIs that hide much of the lower-level plumbing, includingauthentication, request retries, and error handling.

    ExamplesExamples that show how to use the library to build applications.

    DocumentationInformation about how to use the library and code samples as well as online video tutorials andreference documentation.

    Getting Started (p. 4)If you are just starting out with the AWS SDK for PHP, you should first read through the GettingStarted (p. 4) section. It will guide you through setting up your development environment and introducethe samples that are included with the SDK.

    Version v1.0.01

    AWS SDK for PHP Developer GuideIMPORTANT DEPRECATION NOTICE

    http://aws.amazon.com/sdkforphp/

  • Tutorials: Accessing AWS Services from PHP Tutorial: Player Manager

    The first tutorial explains how to use Amazon SimpleDB and Amazon S3 to store information about agroup of peoplesuch as players at a tennis club.

    Tutorial: Amazon EC2 Spot Instances (p. 17)Explains how to set up a request for Amazon EC2 Spot Instances, how to determine when they havecompleted, and how to clean up afterward.

    How-To: Useful Code for Programming AWSThese topics are shorter than the above tutorials and deal with discreet programming tasks related toStart an Amazon EC2 Instance (p. 26).

    Supported ServicesThe AWS SDK for PHP supports the following AWS infrastructure products. The links below take you todetail pages where you can obtain more information about each service.

    Compute

    Amazon EC2

    Auto Scaling

    Elastic Load Balancing

    Amazon Elastic MapReduce

    Content Delivery

    Amazon CloudFront

    Database

    Amazon SimpleDB

    Amazon RDS

    Deployment & Management

    AWS Elastic Beanstalk

    AWS CloudFormation

    Messaging

    Amazon SNS

    Amazon SQS

    Amazon SES

    Monitoring

    Amazon CloudWatch

    Networking

    Amazon VPC

    Security

    Identity and Access Management

    AWS Secure Token Service

    Version v1.0.02

    AWS SDK for PHP Developer GuideTutorials: Accessing AWS Services from PHP

    http://aws.amazon.com/ec2http://aws.amazon.com/autoscalinghttp://aws.amazon.com/elasticloadbalancinghttp://aws.amazon.com/elasticmapreducehttp://aws.amazon.com/cloudfronthttp://aws.amazon.com/simpledbhttp://aws.amazon.com/rdshttp://aws.amazon.com/elasticbeanstalkhttp://aws.amazon.com/cloudformationhttp://aws.amazon.com/snshttp://aws.amazon.com/sqshttp://aws.amazon.com/seshttp://aws.amazon.com/cloudwatchhttp://aws.amazon.com/vpchttp://aws.amazon.com/iamhttp://docs.aws.amazon.com/STS/latest/APIReference/

  • Storage

    Amazon S3

    Import/Export

    Revision History for the AWS SDK for PHPWe regularly release updates to the AWS SDK for PHP to support new services and new service features.To see what changed with a given release, you can check the release notes history.

    Also, each release of the AWS SDK for PHP is published to GitHub. The comments in the commit historyprovide information about what changed in each commit.To view the comments associated with a commit,click on the plus sign next to that commit.

    Additional ResourcesThe Further Resources (p. 31) section has pointers to other resources to assist you in programmingAWS.

    About Amazon Web ServicesAmazon Web Services (AWS) is a collection of digital infrastructure services that developers can leveragewhen developing their applications. The services include computing, storage, database, and applicationsynchronization (messaging and queuing). AWS uses a pay-as-you-go service model.You are chargedonly for the services that you--or your applications--use. Also, to make AWS more approachable as aplatform for prototyping and experimentation, AWS offers a free usage tier. On this tier, services are freebelow a certain level of usage. For more information about AWS costs and the Free Tier go to Test-DrivingAWS in the Free Usage Tier. To obtain an AWS account, go to the AWS home page and click the SignUp button.

    Version v1.0.03

    AWS SDK for PHP Developer GuideRevision History for the AWS SDK for PHP

    http://aws.amazon.com/s3http://aws.amazon.com/importexporthttp://aws.amazon.com/releasenotes/PHP?browse=1https://github.com/amazonwebservices/aws-sdk-for-php/commits/masterhttp://docs.aws.amazon.com/FeaturedArticles/latest/TestDriveFreeTier.htmlhttp://docs.aws.amazon.com/FeaturedArticles/latest/TestDriveFreeTier.htmlhttps://portal.aws.amazon.com/gp/aws/developer/registration/index.html

  • Getting Started

    To get started with the AWS SDK for PHP, you need to set up the following:

    AWS Account and Credentials

    PHP Development Environment

    AWS SDK for PHP

    AWS Account and CredentialsTo access AWS, you will need to sign up for an AWS account.

    To sign up for an AWS account

    1. Go to http://aws.amazon.com, and then click Sign Up.

    2. Follow the on-screen instructions.

    Part of the sign-up procedure involves receiving a phone call and entering a PIN using the phonekeypad.

    AWS sends you a confirmation e-mail after the sign-up process is complete. At any time, you can viewyour current account activity and manage your account by going to http://aws.amazon.com and clickingMy Account/Console.

    To get your access key ID and secret access key

    Access keys consist of an access key ID and secret access key, which are used to sign programmaticrequests that you make to AWS. If you don't have access keys, you can create them by using the AWSManagement Console.

    NoteTo create access keys, you must have permissions to perform the required IAM actions. Formore information, see Granting IAM User Permission to Manage Password Policy and Credentialsin Using IAM.

    1. Go to the IAM console.