Skip to main content

Configure an Amazon S3 bucket

This tutorial demonstrates configuring an Amazon S3 bucket to send your telemetry data to Coralogix. For GCP environments, see Connect a GCS archive bucket.

New teams start with a Coralogix-managed archive. Managed archives keep data for 14 days. Connect your own bucket to keep data longer or to control retention yourself.

Overview​

Use your archive buckets to keep your data for as long as you need, in your own S3 bucket, with no retention limit. Coralogix writes logs and traces to a separate bucket from metrics, so you configure each bucket separately. Logs and traces land as Parquet objects, as the path examples under Logs & traces show.

There are three configuration options:

  • CloudFormation

  • Terraform module

  • Manual

Note

Make sure to match your bucket region with the region associated with your Coralogix account.

Warning

Logs older than 24 hours are kept only in your archive. Until you configure one, Coralogix drops them without notice, even when Allow old logs is on.

S3 bucket usage across teams​

Coralogix supports configuring a shared S3 bucket for multiple teams to store logs or metrics, with internal mechanisms to ensure data partitioning.

Metrics​

  • Multiple teams can upload metrics to the same S3 bucket.
  • Data is partitioned by companyId, ensuring isolation.
  • The companyId is specified in the metadata (meta.json) file accompanying each folder.

Logs & traces​

  • Logs from multiple teams can also be stored in the same S3 bucket.
  • Each team writes to a separate directory path within the bucket, ensuring data separation.

A directory path is built as follows:

s3://BUCKET_NAME/PREFIX/OBJECT.suffix

Team "0" example:

s3://my-bucket-name/cx/parquet/v1/team_id=0/dt=2025-06-29/hr=07/my-object-name.parquet

Team "1" example:

s3://my-bucket-name/cx/parquet/v1/team_id=1/dt=2025-06-29/hr=07/my-object-name.parquet

Configuration with CloudFormation​

1.

Create a new stack with new resources.

2.

Specify your stack details.

  • Input a unique LogsBucketName and/or MetricsBucketName.
  • If your bucket needs to be encrypted and you are using KMS, ensure that the KMS is in the same region as your bucket.
  • Parameters that you don’t need may be left empty.
  • Follow AWS bucket naming rules. Every S3 bucket name must be globally unique.

3.

Run the template to create the S3 archives.

Terraform​

1.

Access the S3-archive module in the Coralogix Terraform Registry.

2.

Create the Terraform file with the following variables.

VariableDescription
aws_regionThe AWS region where you want to create the S3 bucket must be the same as the region where your Coralogix account is set.
logs_bucket_nameThe name of the S3 bucket to create for the logs archive (Leave empty if not needed)
metrics_bucket_nameThe name of the S3 bucket to create for the metrics archive (Leave empty if not needed)

Notes:

provider "aws" {
}

module "s3-archive" {
source = "coralogix/aws/coralogix//modules/provisioning/s3-archive"

aws_region = "<your aws region>"
logs_bucket_name = "<your logs bucket name>"
metrics_bucket_name = "<your metrics bucket name>"
}
3.

[Optional] Add KMS keys to the buckets with logs_kms_arn and metrics_kms_arn variables.

4.

Create the archive buckets by saving the file and running the following commands:

terraform init

terraform apply

Manual configuration​

1.

Create an S3 bucket for configuration with default parameters.

2.

Search S3 in your AWS search bar and select this service.

3.

Locate and select the bucket of choice for storing the archive.

4.

Navigate to the Permissions tab. Edit the Bucket policy.

5.

Paste the following code and update the name of your bucket. The following provides both a logs and metrics archive bucket configuration snippet.

Notes:

  • For all configured snippets, you must input the ACCOUNT_ID associated with your Coralogix domain (e.g. "us1.coralogix.com") and region (e.g. us1).
DOMAINREGIONACCOUNT_ID
us1.coralogix.comus1 (Ohio)625240141681
us2.coralogix.comus2 (Oregon)739076534691
eu1.coralogix.comeu1 (Ireland)625240141681
eu2.coralogix.comeu2 (Stockholm)625240141681
ap1.coralogix.comap1 (Mumbai)625240141681
ap2.coralogix.comap2 (Singapore)625240141681
ap3.coralogix.comap3 (Jakarta)025066248247
gov1.coralogixgov.usgov1 (AWS GovCloud us-gov-west-1)309801239943
  • GOV1 archive role name. The role suffix for the FedRAMP environment has not been published yet. Request it from your Coralogix account representative or support.fedramp@coralogix.com before configuring a bucket policy for GOV1.
  • In AWS GovCloud, ARNs use the aws-us-gov partition. For a GOV1 archive bucket, write the principal as arn:aws-us-gov:iam::<ACCOUNT_ID>:role/coralogix-archive-<REGION> and the resources as arn:aws-us-gov:s3:::<bucket name>, rather than the arn:aws: form shown in the snippets below.

Archive bucket configuration snippet​

{
"Version": "2012-10-17",
"Id": "MyPolicyID",
"Statement": [
{
"Sid": "MyStatementSid",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::<ACCOUNT_ID>:role/coralogix-archive-<REGION>"
},
"Action": [
"s3:GetObject",
"s3:ListBucket",
"s3:PutObject",
"s3:PutObjectTagging",
"s3:GetObjectTagging",
"s3:DeleteObject",
"s3:DeleteObjectVersion",
"s3:DeleteObjectTagging",
"s3:DeleteObjectVersionTagging"
],
"Resource": [
"arn:aws:s3:::<bucket name>",
"arn:aws:s3:::<bucket name>/*"
]
}
]
}

6.

Click Save changes.

7.

Copy and save the name of the archive for your Coralogix platform setup.

KMS encrypted bucket (optional)​

If your bucket needs to be encrypted and you are using KMS, you will need to grant Coralogix permission to use the specific key to encrypt and decrypt the data when we store it on your bucket. Only those keys that are ‘Customer Managed’ may have their policy modified.

1.

Access KMS and choose the key used for encryption. Note: The key must be in the same region as your archive bucket.

2.

Edit the Key Policy and add the highlighted section below to your KMS key policy or copy the code to give your root user full access.

{
"Version": "2012-10-17",
"Id": "key-consolepolicy-3",
"Statement": [
{
"Sid": "Enable Coralogix Permissions",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::<ACCOUNT_ID>:role/coralogix-archive-<REGION>"
},
"Action": [
"kms:Encrypt",
"kms:Decrypt",
"kms:ReEncrypt*",
"kms:GenerateDataKey*",
"kms:DescribeKey"
],
"Resource": "*"
},
{
"Sid": "Enable root Permissions",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::<your-user>:root"
},
"Action": "kms:*",
"Resource": "*"
}
]
}

3.

Add the key to the S3 bucket. Navigate to your archive bucket. Under Properties, edit the Default encryption.

4.

Select Server-side encryption with AWS Key Management Service keys (SSE-KMS) and insert your KMS ARN. Enable the Bucket Key. Click Save changes.

Notes:

  • For key policy, an asterisk "*" on the resource field refers to the specific KMS key and not all resources.

Coralogix platform setup​

1.

Select the Data Flow tab and click on Setup Archive.

2.

Choose from two bucket options: one for logs & traces (CX data) and one for metrics. You cannot use the same bucket for metrics and logs together.

3.

Click Save.

Notes:

  • This will activate your Archive Storage settings. Find out more here.
4.

Query your Metrics S3 bucket through our hosted Grafana metric index or use our plugin and input metrics_index.

Changing your S3 bucket destination​

To update your S3 bucket destination, modify the bucket name in your platform setup.

When you update the S3 bucket destination used for storing your data, there is no disruption to data availability or query functionality. The system automatically tracks the change and ensures continuity:

  • Historical data remains accessible even after the bucket switch.

  • New data is written to the new bucket, starting from the moment of the change.

  • When querying across a time range that spans both buckets, the system automatically pulls data from both sources as needed, transparently. It has no effect on the query you write.

Understand and avoid excessive S3 costs​

Avoid excess S3 costs when using Coralogix direct S3 queries.

Billing of S3 API calls​

S3 API calls are billed to your AWS account based on the file tier and AWS pricing.

Overview of Amazon S3 infrequent access storage class​

Amazon S3 Infrequent Access storage class is ideally suited for data that isn’t accessed frequently but requires quick accessibility when needed. This storage class offers a cost-effective solution for storing such data. Coralogix customers must understand the specific cost implications of accessing data within this tier.

Cost considerations for Coralogix and Amazon S3 infrequent access​

For applications utilizing Coralogix in conjunction with Amazon S3's Infrequent Access storage, it’s critical to be aware that accessing data stored in this tier might lead to additional costs, especially for querying the data from the Coralogix UI. This is due to the unique pricing structure Amazon S3 applies to data in the infrequent access category.

Ensure optimal data storage management​

To ensure optimal data storage management and avoid unexpected costs, we advise all of our customers to review AWS S3 pricing and familiarize themselves with the details of AWS S3 pricing, especially the sections on the Infrequent Access storage class. Using any tier other than S3 Standard may incur additional AWS costs.

Bucket versioning​

Keep S3 Versioning disabled on your archive buckets to avoid paying for data that Coralogix no longer uses. Buckets created with the CloudFormation template or the Terraform module have versioning disabled.

Coralogix regularly compacts archive data: it rewrites archive files and then deletes the originals. Your lifecycle rules also delete files when their retention period ends. When versioning is enabled, S3 does not remove a deleted or replaced file. It keeps the file as a noncurrent version, and you continue to pay storage for it. Over time, noncurrent versions can make up a large share of your archive storage cost, and Coralogix never reads them.

To check whether versioning is enabled on a bucket, run:

aws s3api get-bucket-versioning --bucket <bucket-name>

An empty response means versioning was never enabled. "Status": "Enabled" means it is on.

Once enabled, versioning can only be suspended, not turned off. Suspending versioning stops new noncurrent versions from being created, but it does not remove the ones that already exist.

Limit noncurrent versions with a lifecycle rule​

If you need versioning, for example for S3 Replication or a compliance requirement, add a lifecycle rule that expires noncurrent versions. The same rule also removes existing noncurrent versions after you suspend versioning. The following rule permanently deletes noncurrent versions 7 days after they become noncurrent, and cleans up the delete markers they leave behind. Set NoncurrentDays to the recovery window you need.

{
"Rules": [
{
"ID": "expire-noncurrent-versions",
"Filter": {},
"Status": "Enabled",
"NoncurrentVersionExpiration": {
"NoncurrentDays": 7
},
"Expiration": {
"ExpiredObjectDeleteMarker": true
}
}
]
}
Warning

put-bucket-lifecycle-configuration replaces the bucket's entire lifecycle configuration. If your bucket already has lifecycle rules, such as the archive retention rules, retrieve them first and add this rule to the same Rules array.

Last updated on