You're viewing **Apigee Edge** documentation.  
[Go to the
**Apigee X** documentation](http://cloud.google.com/apigee/docs). info


> [!NOTE]
> **Note:** Apigee Extensions are available in the Edge UI to Google Cloud Apigee customers with an Enterprise [support](https://cloud.google.com/apigee/pricing) plan.

> [!NOTE]
> **Note:** Extensions marked as deprecated will no longer be available for selection by users. However, the currently deployed version(s) will remain unaffected.

> [!CAUTION]
> **Caution:** This version of the extension is no longer supported and has been deprecated.

<br />

> Version: 1.1.1

Manage files in an Amazon S3 bucket. With this extension, you can list, download, and delete files. You can also generate a signed URL for downloading a file.

Each configured instance of this extension works with a specific bucket. For multiple buckets, use a configured instance of this extension for each bucket.

## Prerequisites

Before using the extension from an API proxy using the [ExtensionCallout policy](https://docs.apigee.com/api-platform/reference/policies/extension-callout-policy), you must:

- Get the [access key ID and secret access key](https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys) for the Amazon S3 bucket you'll be working with.

  You'll need these, along with the AWS bucket name and AWS region, to [configure](https://docs.apigee.com/api-platform/reference/extensions/amazon-s3/amazon-s3-extension-111#configuration_reference) this extension.

## About Amazon S3

[Amazon Simple Storage Service (Amazon S3)](https://docs.aws.amazon.com/s3/index.html) is an object storage service.

## Actions


> [!NOTE]
> **Note:** See the [ExtensionCallout policy](https://docs.apigee.com/api-platform/reference/policies/extension-callout-policy) for more information on setting [`<Action>`](https://docs.apigee.com/api-platform/reference/policies/extension-callout-policy#action_element), [`<Input>`](https://docs.apigee.com/api-platform/reference/policies/extension-callout-policy#input_element), and [`<Output>`](https://docs.apigee.com/api-platform/reference/policies/extension-callout-policy#output_element).

<br />

### deleteFile

Deletes the specified file from an S3 bucket.

### Syntax

    <Action>deleteFile</Action>
    <Input><![CDATA[
    {
      "fileName" : "name-of-file-to-delete"
    }
    ]]>
    </Input>

### Example

    <Action>deleteFile</Action>
    <Input><![CDATA[
    {
      "fileName" : "names.tmp"
    }
    ]]>
    </Input>

#### Request parameters

| Parameter | Description | Type | Default | Required |
|---|---|---|---|---|
| fileName | The name of the file to delete. | String | None. | Yes. |

#### Response

None.

#### Response properties

None.

### downloadFile

Downloads the specified file from an S3 bucket.

### Syntax

    <Action>downloadFile</Action>
    <Input><![CDATA[
    {
      "fileName" : "filename"
    }
    ]]>
    </Input>
    <Output>flow-variable</Output>

### Example

    <Action>downloadFile</Action>
    <Input><![CDATA[
    {
      "fileName" : "product-sheet.pdf"
    }
    ]]>
    </Input>
    <Output>downloaded.file</Output>

#### Request parameters

| Parameter | Description | Type | Default | Required |
|---|---|---|---|---|
| fileName | The name of the file to download. | String | None. | Yes. |

#### Response

JSON with a `content` property containing the file's content.

    {
      "content":"Hello World!"
    }

#### Response properties

| Property | Description | Type | Default |
|---|---|---|---|
| content | A string containing the requested file's content. | String. | None. |

### generateSignedURL

Generates a signed URL for downloading the specified file from an S3 bucket.

### Syntax

    <Action>generateSignedURL</Action>
    <Input><![CDATA[
    {
      "fileName": "filename",
      "expiresIn": duration-in-seconds
    }
    ]]>
    </Input>
    <Output>flow-variable</Output>

### Example

    <Action>generateSignedURL</Action>
    <Input><![CDATA[
    {
      "fileName": "product-info.pdf",
      "expiresIn": 3600
    }
    ]]>
    </Input>
    <Output>download.url</Output>

#### Request parameters

| Parameter | Description | Type | Default | Required |
|---|---|---|---|---|
| fileName | The name of the file to download. | String | None. | Yes. |
| expiresIn | The duration in seconds until the URL expires. | Integer | 86400 | No. |

#### Response

JSON with a `url` string property containing the generated URL.

    {
      "url":"https://fake.s3.amazonaws.com/hello_world.txt?AWSAccessKeyId=123&Expires=1542753572&Signature=ABC"
    }

#### Response properties

| Property | Description | Type | Default |
|---|---|---|---|
| url | A URL to the requested file. | String | None. |

### listFiles

Invokes the execution of an AWS Lambda function.

### Syntax

    <Action>listFiles</Action>
    <Input><![CDATA[{}]]></Input>
    <Output>flow-variable</Output>

You must specify `parsed="false"` on the `<Output>` element if you would like
the variable to contain the raw JSON. Otherwise, the variable is not usable.

### Example

    <Action>listFiles</Action>
    <Input><![CDATA[{}]]></Input>
    <Output parsed="false">listFilesOutput</Output>

#### Request parameters

None.

#### Response

An array of S3 file names.

    ["hello_world.txt"]

#### Response properties

None.

## Configuration Reference

Use the following when you're configuring and deploying this extension for use in API proxies. For steps to configure an extension using the Apigee console, see [Adding and configuring an extension](https://docs.apigee.com/api-platform/extensions/configuring-an-extension).

> [!NOTE]
> **Note:** The ability to configure and deploy extensions is available only to organization administrators.

### Common extension properties

The following properties are present for every extension.

| Property | Description | Default | Required |
|---|---|---|---|
| `name` | Name you're giving this configuration of the extension. | None | Yes |
| `packageName` | Name of the extension package as given by Apigee Edge. | None | Yes |
| `version` | Version number for the extension package from which you're configuring an extension. | None | Yes |
| `configuration` | Configuration value specific to the extension you're adding. See [Properties for this extension package](https://docs.apigee.com/api-platform/reference/extensions/amazon-s3/amazon-s3-extension-111#properties_for_this_extension_package) | None | Yes |

### Properties for this extension package

Specify values for the following configuration properties specific to this extension.

| Property | Description | Default | Required |
|---|---|---|---|
| configuration | Enter the name of the Amazon S3 bucket to use, such as `sample-bucket`. | None. | Yes. |
| configuration | Enter the name of the AWS region to use, such as `us-east-2`. | None. | Yes. |
| credentials | When entered in the Apigee Edge console, this is a JSON file containing your Amazon access key ID and access key in the following form: `{` `"accessKeyId" : access-key-ID,` `"secretAccessKey" : secret-access-key` `}` When sent via the management API, it is a base64-encoded value generated from that key JSON file. | None. | Yes. |