Amazon S3 storage saves message bodies in an S3 bucket. Set ServiceControl/ on an Error instance, or ServiceControl. on an Audit instance, to S3 when the instance uses SQL Server or PostgreSQL storage.
Authentication
Amazon S3 supports two authentication methods:
- Static keys — configure
AccessKeyIdandSecretAccessKeytogether. Both must be set or both must be left empty. - Ambient credentials — when static keys are not set, the AWS SDK default credential chain resolves credentials, such as an IAM role attached to the compute resource.
Required settings
ServiceControl/MessageBody/S3/BucketName
Added in version 7.0.0
The Amazon S3 bucket used to store message bodies when MessageBody/ is S3.
| Context | Name |
|---|---|
| Environment variable | SERVICECONTROL_MESSAGEBODY_S3_BUCKETNAME |
| App config key | ServiceControl/ |
| SCMU field | N/A |
| Type | Default value |
|---|---|
| string | None (required for S3 storage) |
ServiceControl.Audit/MessageBody/S3/BucketName
Added in version 7.0.0
The Amazon S3 bucket used to store message bodies when MessageBody/ is S3.
| Context | Name |
|---|---|
| Environment variable | SERVICECONTROL_AUDIT_MESSAGEBODY_S3_BUCKETNAME |
| App config key | ServiceControl. |
| SCMU field | N/A |
| Type | Default value |
|---|---|
| string | None (required for S3 storage) |
Optional settings
ServiceControl/MessageBody/S3/KeyPrefix
Added in version 7.0.0
The prefix applied to message body object keys in Amazon S3.
| Context | Name |
|---|---|
| Environment variable | SERVICECONTROL_MESSAGEBODY_S3_KEYPREFIX |
| App config key | ServiceControl/ |
| SCMU field | N/A |
| Type | Default value |
|---|---|
| string | error-bodies/ |
ServiceControl.Audit/MessageBody/S3/KeyPrefix
Added in version 7.0.0
The prefix applied to message body object keys in Amazon S3. Every Audit instance has the same default, so set a different key prefix for each Audit instance that uses the same bucket. The exception is Audit instances that share a database, which must all use the same bucket and key prefix.
| Context | Name |
|---|---|
| Environment variable | SERVICECONTROL_AUDIT_MESSAGEBODY_S3_KEYPREFIX |
| App config key | ServiceControl. |
| SCMU field | N/A |
| Type | Default value |
|---|---|
| string | audit-bodies/ |
Audit instances with different retention periods must use separate key prefixes when they share an S3 bucket. Audit instances use the same default key prefix, so explicitly configure a different ServiceControl. for each instance. Retention cleanup deletes objects by time prefix across the configured key prefix. An instance with shorter retention can delete bodies that another instance still needs, leaving message records visible but their bodies unavailable.
ServiceControl/MessageBody/S3/Region
Added in version 7.0.0
The AWS region containing the S3 bucket. When this setting is not specified, the AWS SDK resolves the region from its default configuration chain.
| Context | Name |
|---|---|
| Environment variable | SERVICECONTROL_MESSAGEBODY_S3_REGION |
| App config key | ServiceControl/ |
| SCMU field | N/A |
| Type | Default value |
|---|---|
| string | None |
ServiceControl.Audit/MessageBody/S3/Region
Added in version 7.0.0
The AWS region containing the S3 bucket. When this setting is not specified, the AWS SDK resolves the region from its default configuration chain.
| Context | Name |
|---|---|
| Environment variable | SERVICECONTROL_AUDIT_MESSAGEBODY_S3_REGION |
| App config key | ServiceControl. |
| SCMU field | N/A |
| Type | Default value |
|---|---|
| string | None |
ServiceControl/MessageBody/S3/ServiceUrl
Added in version 7.0.0
The service URL for an S3-compatible storage provider. Leave this setting empty when using Amazon S3.
| Context | Name |
|---|---|
| Environment variable | SERVICECONTROL_MESSAGEBODY_S3_SERVICEURL |
| App config key | ServiceControl/ |
| SCMU field | N/A |
| Type | Default value |
|---|---|
| string | None |
ServiceControl.Audit/MessageBody/S3/ServiceUrl
Added in version 7.0.0
The service URL for an S3-compatible storage provider. Leave this setting empty when using Amazon S3.
| Context | Name |
|---|---|
| Environment variable | SERVICECONTROL_AUDIT_MESSAGEBODY_S3_SERVICEURL |
| App config key | ServiceControl. |
| SCMU field | N/A |
| Type | Default value |
|---|---|
| string | None |
ServiceControl/MessageBody/S3/AccessKeyId
Added in version 7.0.0
The access key ID used to authenticate with S3. Configure this setting together with ServiceControl/, or leave both empty to use the AWS SDK default credential chain.
| Context | Name |
|---|---|
| Environment variable | SERVICECONTROL_MESSAGEBODY_S3_ACCESSKEYID |
| App config key | ServiceControl/ |
| SCMU field | N/A |
| Type | Default value |
|---|---|
| string | None |
ServiceControl.Audit/MessageBody/S3/AccessKeyId
Added in version 7.0.0
The access key ID used to authenticate with S3. Configure this setting together with ServiceControl., or leave both empty to use the AWS SDK default credential chain.
| Context | Name |
|---|---|
| Environment variable | SERVICECONTROL_AUDIT_MESSAGEBODY_S3_ACCESSKEYID |
| App config key | ServiceControl. |
| SCMU field | N/A |
| Type | Default value |
|---|---|
| string | None |
ServiceControl/MessageBody/S3/SecretAccessKey
Added in version 7.0.0
The secret access key used to authenticate with S3. Configure this setting together with ServiceControl/, or leave both empty to use the AWS SDK default credential chain.
| Context | Name |
|---|---|
| Environment variable | SERVICECONTROL_MESSAGEBODY_S3_SECRETACCESSKEY |
| App config key | ServiceControl/ |
| SCMU field | N/A |
| Type | Default value |
|---|---|
| string | None |
ServiceControl.Audit/MessageBody/S3/SecretAccessKey
Added in version 7.0.0
The secret access key used to authenticate with S3. Configure this setting together with ServiceControl., or leave both empty to use the AWS SDK default credential chain.
| Context | Name |
|---|---|
| Environment variable | SERVICECONTROL_AUDIT_MESSAGEBODY_S3_SECRETACCESSKEY |
| App config key | ServiceControl. |
| SCMU field | N/A |
| Type | Default value |
|---|---|
| string | None |
Setup and runtime
Setup creates the configured bucket if it does not exist. To check for the bucket, setup reads the bucket's access control list, so the identity used for setup needs s3:GetBucketAcl and, to create the bucket, s3:CreateBucket. If setup cannot read the access control list, it assumes the bucket exists and does not create it; create the bucket in advance when the setup identity lacks these permissions.
The runtime identity needs s3:GetObject, s3:PutObject, and s3:DeleteObject on objects in the bucket, and s3:ListBucket on the bucket itself. The retention sweeper deletes body objects before removing the corresponding database records.
Grant s3:ListBucket to the runtime identity. Before storing a body, ServiceControl checks whether the object already exists. Without s3:ListBucket, Amazon S3 answers that check for a missing object with 403 Forbidden instead of 404 Not Found, and every message body that goes to the external store fails to be stored.
For S3-compatible storage, set ServiceUrl to the endpoint URL. ServiceControl uses path-style addressing when a service URL is configured. Leave ServiceUrl unset when using Amazon S3.
Set these variables in the instance's environment to use static keys. Replace the credential placeholders with secrets supplied by the deployment environment:
SERVICECONTROL_MESSAGEBODY_STORAGETYPE=S3
SERVICECONTROL_MESSAGEBODY_S3_BUCKETNAME=servicecontrol-bodies
SERVICECONTROL_MESSAGEBODY_S3_ACCESSKEYID=...
SERVICECONTROL_MESSAGEBODY_S3_SECRETACCESSKEY=...
SERVICECONTROL_MESSAGEBODY_S3_REGION=us-east-1
Example environment variables using ambient credentials:
SERVICECONTROL_MESSAGEBODY_STORAGETYPE=S3
SERVICECONTROL_MESSAGEBODY_S3_BUCKETNAME=servicecontrol-bodies
SERVICECONTROL_MESSAGEBODY_S3_REGION=us-east-1
Audit instances use the same settings with the SERVICECONTROL_AUDIT_ prefix. Set a key prefix for each Audit instance that uses the same bucket, except Audit instances that share a database:
SERVICECONTROL_AUDIT_MESSAGEBODY_STORAGETYPE=S3
SERVICECONTROL_AUDIT_MESSAGEBODY_S3_BUCKETNAME=servicecontrol-bodies
SERVICECONTROL_AUDIT_MESSAGEBODY_S3_KEYPREFIX=audit-instance1/
SERVICECONTROL_AUDIT_MESSAGEBODY_S3_REGION=us-east-1
See the external message body storage overview for shared configuration, retention, and backup guidance.