Amazon AWS SDK Guía de instalación

Busca en linea o descarga Guía de instalación para Software Amazon AWS SDK. Amazon AWS SDK Installation guide Manual de usuario

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 151
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente

Indice de contenidos

Pagina 1 - AWS SDK for PHP

AWS SDK for PHPversion 2.5.2Amazon Web ServicesJanuary 29, 2014

Pagina 2

Creating snapshots 99Events 99API Reference 100Amazon Route 53 100Creating a client 101Factory method 101Service builder 101API Reference 101Amazon Si

Pagina 3 - Contents

CancelJob CreateJobCreatePipeline CreatePresetDeletePipeline DeletePresetListJobsByPipeline ListJobsByStatusListPipelines ListPresetsReadJob ReadPipel

Pagina 4

This guide is incompleteThis guide is not quite finished. If you are looking for a good way to contribute to the SDK and to the rest of theAWS PHP com

Pagina 5

A more robust way to connect to Amazon Glacier is through the service builder. This allows you to specifycredentials and other configuration settings

Pagina 6

use Aws\Iam\IamClient;$client = IamClient::factory(array( 'key' => '<aws access key>', 'secret' =>

Pagina 7

DeleteSigningCertificate DeleteUserDeleteUserPolicy DeleteVirtualMFADeviceEnableMFADevice GetAccountPasswordPolicyGetAccountSummary GetGroupGetGroupPo

Pagina 8

You can provide your access keys like in the preceding example, or you can choose to omit them if you are usingAWS Identity and Access Management (IAM

Pagina 9

'secret' => '<aws secret key>', 'region' => '<region name>'));You can provide your ac

Pagina 10

AWS OpsWorksThis guide focuses on the AWS SDK for PHP client for AWS OpsWorks. This guide assumes that you have alreadydownloaded and installed the AW

Pagina 11

AttachElasticLoadBalancer CloneStackCreateApp CreateDeploymentCreateInstance CreateLayerCreateStack CreateUserProfileDeleteApp DeleteInstanceDeleteLay

Pagina 12

use Aws\Rds\RdsClient;$client = RdsClient::factory(array( 'key' => '<aws access key>', 'secret' =>

Pagina 13

Factory method 113Service builder 114Creating domains 114List all domains 114Retrieving a domain 114Adding items 114Retrieving items 115GetAttributes

Pagina 14 - Installation

DescribeDBParameterGroups DescribeDBParametersDescribeDBSecurityGroups DescribeDBSnapshotsDescribeDBSubnetGroups DescribeEngineDefaultParametersDescri

Pagina 15 - Installing via Phar

$aws = Aws::factory('/path/to/my_config.json');// Get the client from the builder by namespace$client = $aws->get('Redshift');C

Pagina 16 - Getting Started Guide

$events = $client->getIterator('DescribeEvents', array( 'StartTime' => strtotime('-3 days'), 'EndTime&

Pagina 17 - Creating a client object

Creating a clientFirst you need to create a client object using one of the following techniques.Factory methodThe easiest way to get up and running qu

Pagina 18 - Performing service operations

Amazon Simple Storage ServiceThis guide focuses on the AWS SDK for PHP client for Amazon Simple Storage Service. This guide assumes thatyou have alrea

Pagina 19 - Detecting and handling errors

// Create a valid bucket and use a LocationConstraint$result = $client->createBucket(array( 'Bucket' => $bucket, &ap

Pagina 20 - Migration Guide

// Upload an object by streaming the contents of a file// $pathToFile should be absolute path to a file on disk$result = $client->putObject(array(

Pagina 21 - What's Different?

// Grab the nested Owner/ID value from the result model using getPath()$result = $client->listBuckets();echo $result->getPath('Owner/ID&apo

Pagina 22 - Service Operations

// Seek to the beginning of the stream$result['Body']->rewind();// Read the body off of the underlying stream in chunkswhile ($data = $re

Pagina 23 - Exceptions

->setKey('my-object-key') ->setConcurrency(3) ->build();You can use the Aws\S3\S3Client::upload() method if you just want

Pagina 24 - Iterators

Amazon Simple Workflow Service 125Creating a client 125Factory method 125Service builder 126API Reference 126DynamoDB Session Handler 127Introduction

Pagina 25 - From Version 1 of the SDK

The most common scenario is creating a pre-signed URL to GET an object. The easiest way to do this is to use thegetObjectUrl method of the Amazon S3 c

Pagina 26

echo file_get_contents($signedUrl);// > Hello!Amazon S3 stream wrapperThe Amazon S3 stream wrapper allows you to store and retrieve data from Amazo

Pagina 27 - Side-by-side Guide

'debug' => true));More control with the UploadSyncBuilderThe uploadDirectory() method is an abstraction layer over the much mor

Pagina 28 - Without Composer

debug Set to true to enable debug mode to print information about each download. Setting this value to anfopen resource will write the debug output to

Pagina 29 - Complete Examples

GetBucketLocation (service docs) GetBucketLogging (service docs)GetBucketNotification (service docs) GetBucketPolicy (service docs)GetBucketRequestPay

Pagina 30

use Aws\Common\Aws;// Create a service builder using a configuration file$aws = Aws::factory('/path/to/my_config.json');// Get the client fr

Pagina 31 - Introduction

'key' => '<aws access key>', 'secret' => '<aws secret key>', 'region'

Pagina 32 - Caching IAM role credentials

After creating a domain, you are ready to start putting data into it. Domains consist of items, which are described byattribute name-value pairs. Item

Pagina 33

Because some responses will be truncated and require subsequent requests, it is recommended to always use theSelect iterator to easily retrieve an ent

Pagina 34

A region parameter is also required and must be set to one of the following values: us-east-1,ap-northeast-1, sa-east-1, ap-southeast-1, ap-southeast-

Pagina 35

AWS SDK for PHPSigning Up for AWSImportantThis page is obsolete. Please see About Access Keys.Creating an AWS accountBefore you begin, you need to cre

Pagina 36 - Getting temporary credentials

RemovePermission SetEndpointAttributesSetPlatformApplicationAttributes SetSubscriptionAttributesSetTopicAttributes SubscribeUnsubscribeAmazon Simple Q

Pagina 37 - Configuring the SDK

use Aws\Common\Enum\Size;use Aws\Sqs\Enum\QueueAttribute;$result = $client->createQueue(array( 'QueueName' => 'my-queue'

Pagina 38

$result = $client->receiveMessage(array( 'QueueUrl' => $queueUrl, 'WaitTimeSeconds' => 10,));NoteYou can als

Pagina 39 - Client configuration options

Service builderA more robust way to connect to AWS Storage Gateway is through the service builder. This allows you to specifycredentials and other con

Pagina 40 - Setting a custom endpoint

RetrieveTapeRecoveryPoint ShutdownGatewayStartGateway UpdateBandwidthRateLimitUpdateChapCredentials UpdateGatewayInformationUpdateGatewaySoftwareNow U

Pagina 41 - Command Objects

AWS STS has five operations that return temporary credentials: AssumeRole, AssumeRoleWithWebIdentity,AssumeRoleWithSAML, GetFederationToken, and GetSe

Pagina 42 - Using command objects

$credentials = $sts->createCredentials($sts->getSessionToken());$s3->setCredentials($credentials);This guide is incompleteThis guide is not q

Pagina 43 - Using requests and responses

use Aws\Common\Aws;// Create a service builder using a configuration file$aws = Aws::factory('/path/to/my_config.json');// Get the client fr

Pagina 44 - Basic Configuration

'region' => '<region name>'));You can provide your access keys like in the preceding example, or you can choose to om

Pagina 45 - Custom Waiters

SignalWorkflowExecution StartWorkflowExecutionTerminateWorkflowExecutionDynamoDB Session HandlerIntroductionThe DynamoDB Session Handler is a custom s

Pagina 46 - Waiter Definitions

NoteImportant: Your Secret Access Key is a secret, which only you and AWS should know. It is important to keepit confidential to protect your account.

Pagina 47

Before you can actually use the session handler, you need to create a table in which to store the sessions. This canbe done ahead of time through the

Pagina 48 - Iterator Events

gc_batch_size The batch size used for removing expired sessions during garbage collection. Thisdefaults to 25, which is the maximum size of a single B

Pagina 49 - Modeled Responses

Read via session_start()(UsingPessimisticLockingStrategy)• A minimum of 1 write operation.• (Conditional) Additional write operations for each attempt

Pagina 50 - Using data in the model

));$sessionHandler->garbageCollect();You can also use the gc_operation_delay configuration option on the session handler to introduce delays inbetw

Pagina 51 - Static Client Facades

} // Be sure to close the stream resource when you're done with it fclose($stream);}Opening Seekable streamsStreams opened in "r&q

Pagina 52 - Why Use Client Facades?

PHP's fopen() function requires that a $mode option is specified. The mode option specifies whether or not data canbe read or written to a stream

Pagina 53

copy() Copy an object from one location to another. You can pass options available to the CopyObjectoperation into the stream context options to modif

Pagina 54 - Performance Guide

Another easy way to list the contents of the bucket is using the Symfony2 Finder component.<?phprequire 'vendor/autoload.php';use Symfony

Pagina 55 - Modifying APC settings

• SDK Features• Iterators• Waiters• Command Objects• Parallel Commands• Modeled Responses• Static Client Facades• Frequently Asked Questions (FAQ)• Pe

Pagina 56 - Turn off parameter validation

• Amazon Glacier• Using the Amazon Glacier PHP client• PHP API reference• Amazon Kinesis• Using the Kinesis PHP client• PHP API reference• Amazon Reds

Pagina 57

}}Consider tightening your dependencies to a known version (e.g., 2.5.*).2. Download and install Composer.curl -sS https://getcomposer.org/install

Pagina 58 - Comparing SDK1 and SDK2

• Using the CloudTrail PHP client• PHP API reference• AWS Data Pipeline• Using the AWS Data Pipeline PHP client• PHP API reference• AWS Direct Connect

Pagina 59 - How do I disable SSL?

• Providing credentials to the AWS SDK for PHP• Using Credentials from AWS Security Token Service• Iterating through Amazon DynamoDB Results• Sending

Pagina 60

Installing via ZipEach release of the AWS SDK for PHP (since 2.3.2) ships with a zip file containing all of the classes anddependencies you need to ru

Pagina 61 - Auto Scaling

Using Composer require '/path/to/vendor/autoload.php';Using the Phar require '/path/to/aws.phar';Using the Zip require '/path

Pagina 62

Service builderAnother way to instantiate a service client is using the Aws\Common\Aws object (a.k.a the service builder). TheAws object is essentiall

Pagina 63 - AWS CloudFormation

Working with modeled responsesThe result of a performing an operation is what we refer to as a modeled response. Instead of returning the rawXML or JS

Pagina 65

In the following example, the Amazon S3 Client is used to create a bucket. Then the waiter method is used to waituntil the bucket exists.// Create a b

Pagina 66

• PHP 5.3 namespaces• Follows PSR-0, PSR-1, and PSR-2 standards• Built on Guzzle and utilizes the Guzzle feature set• Persistent connection management

Pagina 67

The SDK adopts the PSR standards produced by the PHP Framework Interop Group. An immediately noticeablechange is that all method names are now named u

Pagina 68

// New SDK - PutObject operation$result = $s3->putObject(array( 'Bucket' => 'bucket-name', 'Key' => &a

Pagina 69

Instead of relying on the CFResponse::isOK() method of the previous SDK to determine if an operation issuccessful, the new SDK throws exceptions when

Pagina 70 - Amazon CloudSearch

$s3 = new AmazonS3();$response = $s3->list_parts('my-bucket-name', 'my-object-key', 'my-upload-id', array( 'm

Pagina 71 - AWS CloudTrail

$people = array();// Perform as many Scan operations as needed to acquire all the names of people// that are 16 or olderdo{ // Setup the parameters

Pagina 72 - Amazon CloudWatch

print_r($people);From Version 2 of the SDK<?phprequire '/path/to/vendor/autoload.php';use Aws\Common\Aws;use Aws\DynamoDb\Enum\Comparison

Pagina 73

1. Add both of the SDKs as dependencies in your project's composer.json file.{ "require": { "aws/aws-sdk-php": &quo

Pagina 74 - AWS Data Pipeline

This will automatically set up the service clients from Version 1 of the SDK making them accessible through theservice builder by keys such as v1.s3 a

Pagina 75 - AWS Direct Connect

ContentsAWS SDK for PHP 1Signing Up for AWS 1Creating an AWS account 1To sign up for AWS 1To view your AWS credentials 1Getting your AWS credentials 1

Pagina 76 - Amazon DynamoDB

Example 1 - Dual Amazon S3 ClientsThis example demonstrates using an Amazon S3 client from the AWS SDK for PHP working side-by-side with anAmazon S3 c

Pagina 77 - Creating tables

'RangeKeyElement' => array('N' => $date->format('j')) )))->getResult()->getPath('Item/fla

Pagina 78 - Listing tables

• How many sets of credentials you are using• The type of project you are developing (e.g., application, CLI, library)• How often you rotate your cred

Pagina 79

The easiest way to add a cache to your IAM role credentials is to specify a credentials cache using thecredentials.cache option in a client's fac

Pagina 80 - Query and scan

The SDK provides a service builder that can be used to share configuration values across multiple clients. Theservice builder allows you to specify de

Pagina 81

// Instantiate the S3 client with your AWS credentials$s3Client = S3Client::factory(array( 'credentials' => $credentials));You may als

Pagina 82 - Local secondary indexes

NoteTemporary credentials generated by AWS STS are not supported by every service. Please check if the serviceyou are using supports temporary credent

Pagina 83

However, the best way to provide temporary credentials is to use the createCredentials() helper methodincluded with the StsClient. This method extract

Pagina 84 - Using the WriteRequestBatch

$aws = Aws::factory(array( 'key' => 'YOUR_AWS_ACCESS_KEY_ID', 'secret' => 'YOUR_AWS_SECRET_ACCESS_KE

Pagina 85 - Amazon DynamoDB (2011-12-05)

) ));If you prefer JSON syntax, you can define your configuration in JSON format instead of PHP.{ "includes": ["_aws"

Pagina 86

Iterators 12Comparing Code Samples from Both SDKs 12Example 1 - Amazon S3 ListParts Operation 12From Version 1 of the SDK 12From Version 2 of the SDK

Pagina 87

signature.service The signature service scope for Signature V4. See Setting a custom endpoint.signature.region The signature region scope for Signatur

Pagina 88

$client = DynamoDbClient::factory(array( 'base_url' => 'http://my-custom-url', 'region' => 'my-region

Pagina 89

$command = $dynamoDbClient->getCommand('DescribeTable', array( 'TableName' => 'YourTableName',));$result = $com

Pagina 90

// 2. Prepare$command->prepare();$request = $command->getRequest();// Note: `prepare()` also returns the request object// 3. Execute$command->

Pagina 91 - Amazon Elastic Compute Cloud

// Execute an array of command objects to do them in parallel$s3Client->execute($commands);// Loop over the commands, which have now all been execu

Pagina 92

$s3Client->waitUntilBucketExists(array( 'Bucket' => 'my-bucket', 'waiter.interval' => 10

Pagina 93

namespace MyApp\FakeWaiters{ use Aws\Common\Waiter\AbstractResourceWaiter; class SleptThreeTimes extends AbstractResourceWaiter { publ

Pagina 94 - Amazon ElastiCache

'VaultExists' => array( 'extends' => '__VaultState', 'success.type' =>

Pagina 95

Iterator ObjectsThe actual object returned by getIterator(), and any get[…]Iterator() method, is an instance of theAws\Common\Iterator\AwsResourceIter

Pagina 96 - AWS Elastic Beanstalk

echo "Results received. {$requestCount} request(s) made so far.\n";});foreach ($iterator as $object) { echo $object['Key']

Pagina 97 - Elastic Load Balancing

A peek under the hood 29Using command objects 30Manipulating command objects before execution 30Request and response objects 30Managing command state

Pagina 98 - Amazon Elastic Transcoder

}$isDeleted = (bool) $result->get('DeleteMarker');Of course, you can still use isset() checks if you want to, since Model does implement

Pagina 99

Response Models contain the parsed data from the response from a service operation, so the contents of the modelwill be different depending on which o

Pagina 100 - Amazon Elastic MapReduce

Version 2.4 of the AWS SDK for PHP adds the ability to enable and use static client "facades". These facadesprovide an easy, static interfac

Pagina 101 - Amazon Glacier

'Body' => fopen($file, 'r'),));echo "\nCreated a new object: {$result['ObjectURL']}\n";You can also mou

Pagina 102 - Creating a client

->method('listBuckets') ->will($this->returnValue(new Model(array( 'Buckets' =>

Pagina 103

We have taken great care to ensure that the SDK will perform well in an environment that utilizes an opcode cache.NotePHP 5.5 comes with an opcode cac

Pagina 104 - AWS Import/Export

From the PHP documentationThis defaults to on, forcing APC to stat (check) the script on each request to determine if it has been modified. Ifit has b

Pagina 105 - Amazon Kinesis

'validation' => false));Cache instance profile credentialsWhen you do not provide credentials to the SDK and do not have credentials

Pagina 106 - Creating a stream

Profile your code to find performance bottlenecksYou will need to profile your application to determine the bottlenecks. This can be done using Xdebug

Pagina 107 - AWS OpsWorks

$aws = Aws\Common\Aws::factory(array( 'region' => 'us-west-2', 'key' => '****', 'secret

Pagina 108

Turn off parameter validation 44Cache instance profile credentials 45Check if you are being throttled 45Preload frequently included files 45Profile yo

Pagina 109

use Guzzle\Common\Log\MonologLogAdapter;use Guzzle\Plugin\Log\LogPlugin;use Monolog\Logger;use Monolog\Handler\StreamHandler;// Create a log channel$l

Pagina 110 - Amazon Redshift

...Or by using the the tilde operator. The following statement is equivalent to >=2.4.9,<2.5:{ "require": { "aws/aws-sd

Pagina 111 - Creating snapshots

use Aws\AutoScaling\AutoScalingClient;$client = AutoScalingClient::factory(array( 'key' => '<aws access key>', &

Pagina 112 - Amazon Route 53

DescribeTags DescribeTerminationPolicyTypesDisableMetricsCollection EnableMetricsCollectionExecutePolicy PutNotificationConfigurationPutScalingPolicy

Pagina 113

This guide is incompleteThis guide is not quite finished. If you are looking for a good way to contribute to the SDK and to the rest of theAWS PHP com

Pagina 114 - Amazon Simple Storage Service

// Create a service builder using a configuration file$aws = Aws::factory('/path/to/my_config.json');// Get the client from the builder by n

Pagina 115 - Uploading objects

$signedUrlCannedPolicy = $cloudFront->getSignedUrl(array( 'url' => $streamHostUrl . '/' . $resourceKey, '

Pagina 116 - Listing your buckets

ReStructuredText and generated using Sphinx. Feel free to add some content to our documentation and send apull request to https://github.com/aws/aws-s

Pagina 117 - Downloading objects

A more robust way to connect to Amazon CloudFront is through the service builder. This allows you to specifycredentials and other configuration settin

Pagina 118 - Saving objects to a file

'url' => $streamHostUrl . '/' . $resourceKey, 'expires' => $expires,));For versions of the SDK later th

Pagina 119 - Creating a pre-signed URL

Factory method 58Service builder 59API Reference 59AWS CloudTrail 59Creating a client 59Factory method 59Service builder 60Blog articles 60API Referen

Pagina 120

This guide is incompleteThis guide is not quite finished. If you are looking for a good way to contribute to the SDK and to the rest of theAWS PHP com

Pagina 121 - Syncing data with Amazon S3

Service builderA more robust way to connect to Amazon CloudSearch is through the service builder. This allows you to specifycredentials and other conf

Pagina 122 - Customizing the download sync

A region parameter is also required and must be set to one of the following values: us-west-2, us-east-1use Aws\CloudTrail\CloudTrailClient;$client =

Pagina 123 - Cleaning up

This guide focuses on the AWS SDK for PHP client for Amazon CloudWatch. This guide assumes that you havealready downloaded and installed the AWS SDK f

Pagina 124 - Amazon Simple Email Service

DescribeAlarms DescribeAlarmsForMetricDisableAlarmActions EnableAlarmActionsGetMetricStatistics ListMetricsPutMetricAlarm PutMetricDataSetAlarmStateAW

Pagina 125 - Amazon SimpleDB

pull request to https://github.com/aws/aws-sdk-php. You can view our documentation sources athttps://github.com/aws/aws-sdk-php/tree/master/docs.API R

Pagina 126 - Adding items

$aws = Aws::factory('/path/to/my_config.json');// Get the client from the builder by namespace$client = $aws->get('DirectConnect&apo

Pagina 127 - Retrieving items

'key' => '<aws access key>', 'secret' => '<aws secret key>', 'region'

Pagina 128 - Deleting domains

// Wait until the table is created and active$client->waitUntilTableExists(array( 'TableName' => 'errors'));A full list o

Pagina 129

echo $tableName . "\n";}Iterating over all tablesThe result of a listTables() operation might be truncated. Because of this, it is usual

Pagina 130 - Amazon Simple Queue Service

API Reference 73Amazon DynamoDB (2011-12-05) 73Creating a client 73Factory method 73Service builder 74Creating tables 74Updating a table 74Describing

Pagina 131 - Receiving messages

Retrieving itemsYou can check if the item was added correctly using the getItem() method of the client. Because AmazonDynamoDB works under an 'ev

Pagina 132 - AWS Storage Gateway

Let's say we want a list of all "1201" errors that occurred in the last 15 minutes. We could issue a single query thatwill search by th

Pagina 133

echo $item['error']['S'] . "\n";}Deleting itemsTo delete an item you must use the DeleteItem() method. The following

Pagina 134 - AWS Security Token Service

'KeySchema' => array( array('AttributeName' => 'CustomerId', 'KeyType' => 'HASH'

Pagina 135 - Using Temporary Credentials

array( 'PutRequest' => array( 'Item' => array( 'Cu

Pagina 136 - AWS Support

'id' => $itemId, 'timestamp' => time(), )); $putBatch->add(new PutRequest($item, $tableName))

Pagina 137

'region' => '<region name>', 'version' => '2011-12-05'));You can provide your access keys

Pagina 138

// Update the provisioned throughput capacity of the table$client->updateTable(array( 'TableName' => 'errors', 'P

Pagina 139 - DynamoDB Session Handler

TipYou can convert an iterator to an array using the toArray() method of the iterator.Adding itemsYou can add an item to our errors table using the pu

Pagina 140 - Configuration

echo $result['Item']['message']['S'] . "\n";//> no vacant areasYou can also retrieve items in batches of up

Pagina 141

API Reference 87Amazon Elastic MapReduce 88Creating a client 88Factory method 88Service builder 88API Reference 89Amazon Glacier 89Creating a client 8

Pagina 142 - Garbage Collection

echo $item['error']['S'] . "\n";}ScanA scan operation scans the entire table. You can specify filters to apply to th

Pagina 143 - Amazon S3 Stream Wrapper

If you have a large array of items you wish to add to your table, you could iterate over the them, add each item to thebatch object. After all the ite

Pagina 144 - Uploading data

The easiest way to get up and running quickly is to use the Aws\Ec2\Ec2Client::factory() method andprovide your credentials (key and secret).A region

Pagina 145 - Other object functions

CancelConversionTask CancelExportTaskCancelReservedInstancesListing CancelSpotInstanceRequestsConfirmProductInstance CopyImageCopySnapshot CreateCusto

Pagina 146 - Working with buckets

DescribeSnapshots DescribeSpotDatafeedSubscriptionDescribeSpotInstanceRequests DescribeSpotPriceHistoryDescribeSubnets DescribeTagsDescribeVolumeAttri

Pagina 147 - In-Depth Guides

A region parameter is also required and must be set to one of the following values: us-east-1,ap-northeast-1, sa-east-1, ap-southeast-1, ap-southeast-

Pagina 148 - Service-Specific Guides

DescribeEvents DescribeReplicationGroupsDescribeReservedCacheNodes DescribeReservedCacheNodesOfferingsModifyCacheCluster ModifyCacheParameterGroupModi

Pagina 149

ReStructuredText and generated using Sphinx. Feel free to add some content to our documentation and send apull request to https://github.com/aws/aws-s

Pagina 150 - Articles from the Blog

You can provide your access keys like in the preceding example, or you can choose to omit them if you are usingAWS Identity and Access Management (IAM

Pagina 151 - Presentations

This guide focuses on the AWS SDK for PHP client for Amazon Elastic Transcoder. This guide assumes that youhave already downloaded and installed the A

Comentarios a estos manuales

Sin comentarios