aws_s3_bucket

The aws_s3_bucket directive sets the name of the Amazon S3 bucket to be used for proxy requests.

Syntaxaws_s3_bucket bucket_name;
Defaultnone
Contexthttp, server, location
Arguments1

Description

The aws_s3_bucket directive is part of the NGINX module that enables proxying requests to authenticated AWS services, specifically for interactions with Amazon S3. This directive allows you to specify the S3 bucket that the NGINX server should use when handling requests. By defining the bucket name, NGINX can create the correct endpoint URLs for S3 requests, facilitating seamless access to stored objects within the specified bucket.

This directive requires a single argument, which is the name of the S3 bucket. It can be used in various contexts such as http, server, and location. Users must ensure that they have configured necessary authentication credentials and signing keys through other directives provided in the module, such as aws_access_key, aws_signing_key, and aws_key_scope, to grant NGINX permission to communicate with S3 securely.

When a request is made, if aws_sign is also specified in the relevant location, NGINX will automatically sign the request with the AWS V4 signing process, using the details provided in other relevant directives, making it capable of authenticating against the S3 bucket for access control and data manipulation operations.

Config Example

    location / {
        aws_access_key your_aws_access_key;
        aws_key_scope scope_of_generated_signing_key;
        aws_signing_key signing_key_generated_using_script;
        aws_s3_bucket your_s3_bucket;

        aws_sign;
        proxy_pass http://your_s3_bucket.s3.amazonaws.com;
    }

Ensure that the bucket name specified includes the correct spelling and proper case, as S3 bucket names are case-sensitive.

The signing keys must be kept updated; expired keys will cause authentication failures when accessing the S3 bucket.

Be careful with trailing slashes in your proxy_pass directive; incorrect configurations can lead to unexpected 404 errors.

← Back to all directives