To use the instructions in this guide, you must have the tools and curl script described in this section.
![]() | Tip |
|---|---|
This guide uses our simple curl script to interact with the CloudFront control API. You don't have to use this script; you could use any of the other available tools or libraries that interact with the control API. To get those tools, go to the CloudFront sample code and libraries area of the Resource Center. |
Tools
Perl 5.8.0 or newer (for more information, go to http://www.perl.com/download.csp)
The following Perl modules, which you can download from CPAN (for more information, go to http://search.cpan.org):
Digest::HMAC_SHA1
FindBin
MIME::Base64
Getopt::Long
File::Temp
File::Basename
Fcntl
curl 7.16.2 or newer (for more information, go to http://curl.haxx.se/download.html)
You also need to get the curl script we provide (cfcurl.pl) and prepare it
for use.
To get and prepare the curl script
Download the cfcurl.pl file from the CloudFront sample code area on the Resource Center.
Place the cfcurl.pl file in any location on your machine.
Prepare an.aws-secrets file to store your AWS access identifiers.
The curl script will not accept your Secret Access Key on the command line, so you must store your identifiers in a file.
![]() | Caution |
|---|---|
You must be the owner of the |
In a text editor, create a file with the following contents, and replace the
id and key values with your own AWS Access Key ID
and Secret Access Key. If you have only a single AWS account, you can delete the
section for the secondary account.
The friendly names you use to identify the keys (e.g., "primary" and "secondary") are arbitrary; you can use any names you want.
%awsSecretAccessKeys = (
# primary account
primary => {
id => '<Your primary AWS Access Key ID>',
key => '<Your primary Secret Access Key>',
},
# secondary account
secondary => {
id => '<Your secondary AWS Access Key ID>',
key => '<Your secondary Secret Access Key>',
},
);Name the file .aws-secrets and place it in your home
directory.
For Windows users, your home directory is the value of the HOME environment variable.
The cfcurl.pl script is now ready to use. The commands use the following
simple syntax.
./cfcurl.pl --keyname <friendly key name> -- [curl-options]
If your .aws-secrets file looked like the preceding example, you could use
either primary or secondary as your friendly key name, depending on
which identifiers you want to use for the request.
The following sections show how to use cfcurl.pl to create a distribution.