Getting the Tools and Curl Script

To use the instructions in this guide, you must have the tools and curl script described in this section.

[Tip]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

You also need to get the curl script we provide (cfcurl.pl) and prepare it for use.

To get and prepare the curl script

  1. Download the cfcurl.pl file from the CloudFront sample code area on the Resource Center.

  2. Place the cfcurl.pl file in any location on your machine.

  3. 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]Caution

    You must be the owner of the .aws-secrets file, and it must be readable by only you.

    1. 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>',
          },
      );
    2. 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.