2

How do I do a POST control request to the Amazon cloudfront API? In the docs it says:

Send a CloudFront control API request that is similar to the following example.

POST /2012-05-05/origin-access-identity/cloudfront HTTP/1.1
[Required headers]  

<?xml version="1.0" encoding="UTF-8"?>
<CloudFrontOriginAccessIdentityConfig xmlns="http://cloudfront.amazonaws.com/doc/2012-05-05/">
  <CallerReference>20120229090000</CallerReference>   
  <Comment>Your comments here</Comment>
</CloudFrontOriginAccessIdentityConfig>

I looked around for some information, and I am not sure how to do it. Is it something I can do via a Curl Request like here?

Any help very appreciated! I feel a little lost at the moment.

Many thanks!

Update

I do something like this now, still not working.. Any help?

<?php
$xml = 'POST /2012-05-05/origin-access-identity/cloudfront HTTP/1.1
Host: cloudfront.amazonaws.com
Authorization: [AWS authentication string]
Date: [time stamp]
[Other required headers]    

<?xml version="1.0" encoding="UTF-8"?>
<CloudFrontOriginAccessIdentityConfig xmlns="http://cloudfront.amazonaws.com/doc/2012-05-05/">
   <CallerReference>ref</CallerReference>
   <Comment>The comment.</Comment>
</CloudFrontOriginAccessIdentityConfig>
';

$opts = array(
    'http'=>array(
        'method'=>'POST',
        'header'=>"Content-Type: text/plain\r\n" .
            $auth."\r\n",
        'content'=>$xml
    )
);

$context = stream_context_create($opts);
$url = 'https://cloudfront.amazonaws.com/2012-05-05/origin-access-identity/cloudfront';
$fp = fopen($url, 'r', false, $context);
fpassthru($fp);
$response = stream_get_contents($fp);
print_r($response);
fclose($fp);
?>
Community
  • 1
  • 1
Mike
  • 2,686
  • 7
  • 44
  • 61
  • What do you want to know ? The example you are trying is for creating Origin Access Identity via Post Request. So first clarify what do you want ? and what problem are you facing ? **Creating Distribution** http://docs.amazonwebservices.com/AmazonCloudFront/2012-05-05/APIReference/CreateDistribution.html **Creating Origin Access Identity.** http://docs.amazonwebservices.com/AmazonCloudFront/2012-05-05/APIReference/CreateOAI.html – Tej Kiran May 22 '12 at 06:16
  • It says: "To create a new CloudFront origin access identity, you do a POST on the 2012-05-05/origin-access-identity/cloudfront resource." How do I send the POST? Is it something I have to do via Curl? – Mike May 23 '12 at 12:25

1 Answers1

1

FireFox add-on Poster must help. https://addons.mozilla.org/en-US/firefox/addon/poster/ Other similar tools: Are there Firefox extension (or any other browser) that allow to send arbitrary POST data to a webpage?

Community
  • 1
  • 1
bershika
  • 940
  • 9
  • 8
  • I found out I can use amazon sdk to do it but I ended up using cloudberry and bucketexplorer. Good to know that tool though, thanks! – Mike Jun 14 '12 at 18:36