aws_s3_bucket_metric

Provides a S3 bucket metrics configuration resource.

Example Usage

Add metrics configuration for entire S3 bucket

resource "aws_s3_bucket" "example" {
  bucket = "example"
}

resource "aws_s3_bucket_metric" "example-entire-bucket" {
  bucket = "${aws_s3_bucket.example.bucket}"
  name   = "EntireBucket"
}

Add metrics configuration with S3 bucket object filter

resource "aws_s3_bucket" "example" {
  bucket = "example"
}

resource "aws_s3_bucket_metric" "example-filtered" {
  bucket = "${aws_s3_bucket.example.bucket}"
  name   = "ImportantBlueDocuments"

  filter {
    prefix = "documents/"

    tags {
      priority = "high"
      class = "blue"
    }
  }
}

Argument Reference

The following arguments are supported:

  • bucket - (Required) The name of the bucket to put metric configuration.
  • name - (Required) Unique identifier of the metrics configuration for the bucket.
  • filter - (Optional) Object filtering that accepts a prefix, tags, or a logical AND of prefix and tags (documented below).

The filter metric configuration supports the following:

  • prefix - (Optional) Object prefix for filtering (singular).
  • tags - (Optional) Object tags for filtering (up to 10).

Import

S3 bucket metric configurations can be imported using bucket:metric, e.g.

$ terraform import aws_s3_bucket_metric.my-bucket-entire-bucket my-bucket:EntireBucket

© 2018 HashiCorp
Licensed under the MPL 2.0 License.
https://www.terraform.io/docs/providers/aws/r/s3_bucket_metric.html