aws-php-sdk

Copy AMI to a separate region from a separate account

為{幸葍}努か 提交于 2019-12-10 23:33:13
问题 I have been trying to migrate an AMI from my AWS account A (ap-southeast-2) to Account B (us-east-1). In my account I have given launch permissions to my Account A. However when I run below code, $result = $this->destination_ec2_client->copyImage( array( 'SourceRegion' => $this->source_region, 'SourceImageId' => $image_id, 'Name' => $amis[0]['Name'] )); When I run above code by documentation the call should copy the AMI from source region and copy it to destination region. However, The final

Does Amazon SES support UTF-8 email addresses?

孤人 提交于 2019-12-10 09:53:27
问题 I tried to find details on this but was unable to find any confirmation. I'm using the PHP SDK and tried the following test (email below is an example but gmail supports UTF-8 characters in emails): Send an email with SES to myemail+✖@gmail.com I actually sent the '✖' as is using the PHP SDK and looking at the query it got encoded (URL) in the body of the POST request: Destination.ToAddresses.member.1=myemail%2B%E2%9C%96%40gmail.com Here is what I got from the SES response: <ErrorResponse

AWS S3 uploaded images are getting corrupted

假装没事ソ 提交于 2019-12-08 00:33:28
问题 I am working on AWS ec2 ubuntu machine. My code is in cakephp. When I try to upload any image to AWS S3 it will get corrupted. while it is working fine in core php code. here is my controller code if ($this->User->saveAll($this->request->data)) { // upload on s3 //create file name // echo "<pre>"; print_r($_FILES); die; $temp = explode(".", $_FILES["data"]["name"]["User"]['image']); $newfilename = round(microtime(true)) . '.' . end($temp); $filepath = $_FILES['data']['tmp_name']['User'][

Retrieve object user metadata in S3 - aws sdk v3 php

你离开我真会死。 提交于 2019-12-07 17:40:42
问题 I'm looking to retrieve user-defined meta-data from objects in my S3 bucket, from the php sdk. As per Editing Object Meta Data, User metadata is stored with the object and returned with it, and begin with "x-amz-meta-" I have defined user metadata on objects through the console like "x-amz-meta-test", at both upload time, and adding it after the upload (through web console, not the upload API). The test metadata is never returned. I always get the same system metadata. That is, I get only the

AWS S3 - How to fix 'The request signature we calculated does not match the signature' error?

左心房为你撑大大i 提交于 2019-12-03 19:46:11
问题 I have searched on the web for over two days now, and probably have looked through most of the online documented scenarios and workarounds, but nothing worked for me so far. I am on AWS SDK for PHP V2.8.7 running on PHP 5.3. I am trying to connect to my S3 bucket with the following code: // Create a `Aws` object using a configuration file $aws = Aws::factory('config.php'); // Get the client from the service locator by namespace $s3Client = $aws->get('s3'); $bucket = "xxx"; $keyname = "xxx";

Can't pass my credentials to AWS PHP SDK

ぃ、小莉子 提交于 2019-12-01 00:34:45
I installed AWS PHP SDK and am trying to use SES. My problem is that it's (apparently) trying to read ~/.aws/credentials no matter what I do. I currently have this code: $S3_AK = getenv('S3_AK'); $S3_PK = getenv('S3_PK'); $profile = 'default'; $path = '/home/franco/public/site/default.ini'; $provider = CredentialProvider::ini($profile, $path); $provider = CredentialProvider::memoize($provider); $client = SesClient::factory(array( 'profile' => 'default', 'region' => 'us-east-1', 'version' => "2010-12-01", 'credentials' => [ 'key' => $S3_AK, 'secret' => $S3_PK, ] )); And am still getting "Cannot

Specify Content-Type in AWS PHP's upload function

南笙酒味 提交于 2019-11-30 22:23:30
I am migrating my code from AWS PHP SDK1 to SDK2 ( https://github.com/aws/aws-sdk-php ). I have an image uploader. In my previous version, I would specify the Content-Type of my image like so: $response = $this->s3->create_object( $bucket, $key, array( 'fileUpload'=>$file_resource, 'contentType'=>$mime, 'acl' => AmazonS3::ACL_PUBLIC, ) ); This is my new version: $response = $this->s3->upload( $bucket, $key, $file_resource, 'public-read', array('params' => array('Metadata' => array('ContentType'=>$mime))) ); I've tried different spellings of ContentType, in the S3 site it modifies the name to

Can't pass my credentials to AWS PHP SDK

百般思念 提交于 2019-11-30 19:27:37
问题 I installed AWS PHP SDK and am trying to use SES. My problem is that it's (apparently) trying to read ~/.aws/credentials no matter what I do. I currently have this code: $S3_AK = getenv('S3_AK'); $S3_PK = getenv('S3_PK'); $profile = 'default'; $path = '/home/franco/public/site/default.ini'; $provider = CredentialProvider::ini($profile, $path); $provider = CredentialProvider::memoize($provider); $client = SesClient::factory(array( 'profile' => 'default', 'region' => 'us-east-1', 'version' =>

Specify Content-Type in AWS PHP's upload function

我的未来我决定 提交于 2019-11-30 18:00:35
问题 I am migrating my code from AWS PHP SDK1 to SDK2 (https://github.com/aws/aws-sdk-php). I have an image uploader. In my previous version, I would specify the Content-Type of my image like so: $response = $this->s3->create_object( $bucket, $key, array( 'fileUpload'=>$file_resource, 'contentType'=>$mime, 'acl' => AmazonS3::ACL_PUBLIC, ) ); This is my new version: $response = $this->s3->upload( $bucket, $key, $file_resource, 'public-read', array('params' => array('Metadata' => array('ContentType'

How to fix 'The request signature we calculated does not match the signature' error?

一曲冷凌霜 提交于 2019-11-30 10:42:56
I have searched on the web for over two days now, and probably have looked through most of the online documented scenarios and workarounds, but nothing worked for me so far. I am on AWS SDK for PHP V2.8.7 running on PHP 5.3. I am trying to connect to my S3 bucket with the following code: // Create a `Aws` object using a configuration file $aws = Aws::factory('config.php'); // Get the client from the service locator by namespace $s3Client = $aws->get('s3'); $bucket = "xxx"; $keyname = "xxx"; try { $result = $s3Client->putObject(array( 'Bucket' => $bucket, 'Key' => $keyname, 'Body' => 'Hello