Amazon S3 Destination Config Reference Beta
- free
- growth
- enterprise
5 minute read
Amazon S3 is an object storage destination. RudderStack batches events and writes them as files into an S3 bucket you own.
In a S3 destination spec:
type: s3definition_version: 1
Sample configuration
version: rudder/v1
kind: destination
metadata:
name: amazon-s3-prod
spec:
id: amazon-s3-prod
display_name: Amazon S3 Production
type: s3
definition_version: 1
enabled: true
config:
bucket_name: rudder-events-prod
prefix: rudder/events
role_based_auth: true
iam_role_arn: "arn:aws:iam::123456789012:role/RudderStackS3Access"
enable_sse: false
connection_mode:
web: cloud
android_kotlin: cloud
consent_management:
web:
- provider: oneTrust
consents:
- analytics
- marketingThe above example uses role-based authentication, so it carries no access keys. Which of iam_role_arn, access_key_id, and access_key you set depends on role_based_auth — see Authentication.
Config keys
config accepts only the keys listed below. The shared config key rules cover unknown keys, defaults, and immutability.
Bucket
bucket_name
RequiredType:
string
Description: Name of the S3 bucket RudderStack writes event files to. The bucket must already exist.
Notes:
- At most 100 characters, and must not contain line breaks.
- A
{{ path || fallback }}template is accepted in place of a literal, and isn’t measured against the length limit.
prefix
Type:
string
Description:
Folder prefix inside the bucket. RudderStack creates a folder with this name and writes all files beneath it, at s3://<bucket_name>/<prefix>/.
Notes:
- At most 100 characters, and must not contain line breaks.
- Templates are accepted on the same terms as
bucket_name.
enable_sse
Type:
boolean
Default value:
false
Description:
Enable server-side encryption. When true, RudderStack adds the header x-amz-server-side-encryption: AES256 to each PutObject request.
Authentication
role_based_auth selects the authentication method, and decides which of the remaining three keys are required.
Rudder CLI checks only that the keys the selected method needs are present. It doesn’t reject the keys belonging to the other method, so a spec carrying both an
iam_role_arnand an access key pair passesvalidateand applies.Leave the unused method’s keys out — otherwise you store credentials the destination never reads.
role_based_auth
RequiredType:
boolean
Description:
Whether to authenticate with an IAM role. Set it to true to use iam_role_arn, or false to use the access key pair.
Notes:
- Rudder CLI requires this key explicitly, unlike the dashboard, which defaults it to on.
- A spec that omits this key fails validation with
'role_based_auth' is required.
iam_role_arn
RequiredType:
string
Description: ARN of the IAM role RudderStack assumes to write to the bucket.
Notes:
- Required when
role_based_authistrue. Leave it unset otherwise. - At most 100 characters, and must not contain line breaks.
- Templates are accepted.
access_key_id
RequiredSecretType:
string
Description: AWS access key ID authorizing RudderStack to write to the bucket.
Notes:
- Required when
role_based_authisfalse. Leave it unset otherwise.
{{ .VAR }} reference rather than a literal — see Secrets.access_key
RequiredSecretType:
string
Description:
AWS secret access key matching access_key_id.
Notes:
- Required when
role_based_authisfalse.
RudderStack recommends role-based authentication. The access key method is deprecated and will be discontinued. See Permissions.
Either method needs a bucket policy granting RudderStack write access. Role-based authentication on its own doesn’t grant it.
Per-source keys
Both keys are objects keyed by the local source type — the tokens listed under Source types. A key naming a source type this destination doesn’t support fails validation.
connection_mode
Type:
object
Description: Maps each source type you connect to the mode its events reach S3 in, using the modes in Source types.
Notes:
- An entry is required for each source type you connect — see Connect a source.
connection_mode:
web: cloud
android_kotlin: cloudconsent_management
Type:
object
Description:
Consent provider configuration per source type. The entry shape, accepted providers, and the rules on resolution_strategy and consents are shared across all destination types — see Consent management.
Source types
Amazon S3 accepts events from these source types in the mentioned connection modes:
| Source type | Connection mode |
|---|---|
android | cloud |
android_kotlin | cloud |
ios | cloud |
ios_swift | cloud |
web | cloud |
unity | cloud |
react_native | cloud |
flutter | cloud |
cordova | cloud |
cloud | cloud |
Every source type is cloud only — events reach the bucket from RudderStack’s servers, never in device mode.
The dashboard additionally offers S3 to AMP, Shopify, and Reverse ETL sources. Rudder CLI doesn’t manage those connections, soamp,shopify, andwarehouseare invalid here.
Connect a source
An event stream connection to this destination is checked against two rules at validate time.
The source’s type must be supported. A source’s type resolves to one of the tokens above before the check — a JavaScript source resolves to web, and webhook and server-side SDK sources resolve to cloud. An unsupported type reports:
destination 'amazon-s3-prod' (type 's3') does not support source 'my-source':
source type 'amp' is not among supported source types: android, android_kotlin, ...The destination config must carry a connection_mode entry for that source type. This lives on the destination spec, not on the connection spec. Without it:
destination 'amazon-s3-prod' config has no 'connection_mode' entry for source type 'web'Amazon S3 needs no additional config keys to connect a source of any type.
Secrets
access_key_id and access_key are the secret keys, and apply only when role_based_auth is false. Write each as a {{ .VAR }} reference and supply the value at apply time:
config:
bucket_name: rudder-events-prod
role_based_auth: false
access_key_id: "{{ .AWS_ACCESS_KEY_ID }}"
access_key: "{{ .AWS_SECRET_ACCESS_KEY }}"export RUDDER_AWS_ACCESS_KEY_ID="AKIAIOSFODNN7EXAMPLE"
export RUDDER_AWS_SECRET_ACCESS_KEY="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
rudder-cli apply
# or
rudder-cli apply --var-file secrets.vars.yamlNote that:
- A
{{ .VAR }}reference satisfies the requirement check, so a spec using role-free authentication validates before the values are supplied. rudder-cli importwrites both keys back as{{ .VAR }}placeholders rather than their values, since the API doesn’t return secrets. Fill the placeholders in before the first apply.iam_role_arnisn’t a secret — an ARN identifies a role but grants nothing on its own.
See How to Use Variable Substitution in Rudder CLI.
See more
- Amazon S3 Destination for bucket setup, permissions, and the file format RudderStack writes
- Destination Type Reference for Rudder CLI for the rules shared across destination types
- Destination YAML Reference for the spec envelope