BucketMetric

Provides a S3 bucket metrics configuration resource.

Example Usage

Add metrics configuration for entire S3 bucket

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var example = new Aws.S3.Bucket("example", new Aws.S3.BucketArgs
        {
        });
        var example_entire_bucket = new Aws.S3.BucketMetric("example-entire-bucket", new Aws.S3.BucketMetricArgs
        {
            Bucket = example.BucketName,
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v4/go/aws/s3"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := s3.NewBucket(ctx, "example", nil)
		if err != nil {
			return err
		}
		_, err = s3.NewBucketMetric(ctx, "example_entire_bucket", &s3.BucketMetricArgs{
			Bucket: example.Bucket,
		})
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_aws as aws

example = aws.s3.Bucket("example")
example_entire_bucket = aws.s3.BucketMetric("example-entire-bucket", bucket=example.bucket)
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.s3.Bucket("example", {});
const example_entire_bucket = new aws.s3.BucketMetric("example-entire-bucket", {bucket: example.bucket});

Add metrics configuration with S3 bucket object filter

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var example = new Aws.S3.Bucket("example", new Aws.S3.BucketArgs
        {
        });
        var example_filtered = new Aws.S3.BucketMetric("example-filtered", new Aws.S3.BucketMetricArgs
        {
            Bucket = example.BucketName,
            Filter = new Aws.S3.Inputs.BucketMetricFilterArgs
            {
                Prefix = "documents/",
                Tags = 
                {
                    { "priority", "high" },
                    { "class", "blue" },
                },
            },
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v4/go/aws/s3"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := s3.NewBucket(ctx, "example", nil)
		if err != nil {
			return err
		}
		_, err = s3.NewBucketMetric(ctx, "example_filtered", &s3.BucketMetricArgs{
			Bucket: example.Bucket,
			Filter: &s3.BucketMetricFilterArgs{
				Prefix: pulumi.String("documents/"),
				Tags: pulumi.StringMap{
					"priority": pulumi.String("high"),
					"class":    pulumi.String("blue"),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_aws as aws

example = aws.s3.Bucket("example")
example_filtered = aws.s3.BucketMetric("example-filtered",
    bucket=example.bucket,
    filter=aws.s3.BucketMetricFilterArgs(
        prefix="documents/",
        tags={
            "priority": "high",
            "class": "blue",
        },
    ))
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.s3.Bucket("example", {});
const example_filtered = new aws.s3.BucketMetric("example-filtered", {
    bucket: example.bucket,
    filter: {
        prefix: "documents/",
        tags: {
            priority: "high",
            "class": "blue",
        },
    },
});

Create a BucketMetric Resource

new BucketMetric(name: string, args: BucketMetricArgs, opts?: CustomResourceOptions);
@overload
def BucketMetric(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 bucket: Optional[str] = None,
                 filter: Optional[BucketMetricFilterArgs] = None,
                 name: Optional[str] = None)
@overload
def BucketMetric(resource_name: str,
                 args: BucketMetricArgs,
                 opts: Optional[ResourceOptions] = None)
func NewBucketMetric(ctx *Context, name string, args BucketMetricArgs, opts ...ResourceOption) (*BucketMetric, error)
public BucketMetric(string name, BucketMetricArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args BucketMetricArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args BucketMetricArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args BucketMetricArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args BucketMetricArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

BucketMetric Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.

Inputs

The BucketMetric resource accepts the following input properties:

Bucket string
The name of the bucket to put metric configuration.
Filter BucketMetricFilterArgs
Object filtering that accepts a prefix, tags, or a logical AND of prefix and tags (documented below).
Name string
Unique identifier of the metrics configuration for the bucket.
Bucket string
The name of the bucket to put metric configuration.
Filter BucketMetricFilter
Object filtering that accepts a prefix, tags, or a logical AND of prefix and tags (documented below).
Name string
Unique identifier of the metrics configuration for the bucket.
bucket string
The name of the bucket to put metric configuration.
filter BucketMetricFilterArgs
Object filtering that accepts a prefix, tags, or a logical AND of prefix and tags (documented below).
name string
Unique identifier of the metrics configuration for the bucket.
bucket str
The name of the bucket to put metric configuration.
filter BucketMetricFilterArgs
Object filtering that accepts a prefix, tags, or a logical AND of prefix and tags (documented below).
name str
Unique identifier of the metrics configuration for the bucket.

Outputs

All input properties are implicitly available as output properties. Additionally, the BucketMetric resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.

Look up an Existing BucketMetric Resource

Get an existing BucketMetric resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: BucketMetricState, opts?: CustomResourceOptions): BucketMetric
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        bucket: Optional[str] = None,
        filter: Optional[BucketMetricFilterArgs] = None,
        name: Optional[str] = None) -> BucketMetric
func GetBucketMetric(ctx *Context, name string, id IDInput, state *BucketMetricState, opts ...ResourceOption) (*BucketMetric, error)
public static BucketMetric Get(string name, Input<string> id, BucketMetricState? state, CustomResourceOptions? opts = null)
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.

The following state arguments are supported:

Bucket string
The name of the bucket to put metric configuration.
Filter BucketMetricFilterArgs
Object filtering that accepts a prefix, tags, or a logical AND of prefix and tags (documented below).
Name string
Unique identifier of the metrics configuration for the bucket.
Bucket string
The name of the bucket to put metric configuration.
Filter BucketMetricFilter
Object filtering that accepts a prefix, tags, or a logical AND of prefix and tags (documented below).
Name string
Unique identifier of the metrics configuration for the bucket.
bucket string
The name of the bucket to put metric configuration.
filter BucketMetricFilterArgs
Object filtering that accepts a prefix, tags, or a logical AND of prefix and tags (documented below).
name string
Unique identifier of the metrics configuration for the bucket.
bucket str
The name of the bucket to put metric configuration.
filter BucketMetricFilterArgs
Object filtering that accepts a prefix, tags, or a logical AND of prefix and tags (documented below).
name str
Unique identifier of the metrics configuration for the bucket.

Supporting Types

BucketMetricFilter

Prefix string
Object prefix for filtering (singular).
Tags Dictionary<string, string>
Object tags for filtering (up to 10).
Prefix string
Object prefix for filtering (singular).
Tags map[string]string
Object tags for filtering (up to 10).
prefix string
Object prefix for filtering (singular).
tags {[key: string]: string}
Object tags for filtering (up to 10).
prefix str
Object prefix for filtering (singular).
tags Mapping[str, str]
Object tags for filtering (up to 10).

Import

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

 $ pulumi import aws:s3/bucketMetric:BucketMetric my-bucket-entire-bucket my-bucket:EntireBucket

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.