AWS Classic

Pulumi Official
Package maintained by Pulumi
v5.4.0 published on Wednesday, May 4, 2022 by Pulumi

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.BucketV2("example", new Aws.S3.BucketV2Args
        {
        });
        var example_entire_bucket = new Aws.S3.BucketMetric("example-entire-bucket", new Aws.S3.BucketMetricArgs
        {
            Bucket = example.Bucket,
        });
    }

}
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := s3.NewBucketV2(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
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var example = new BucketV2("example");

        var example_entire_bucket = new BucketMetric("example-entire-bucket", BucketMetricArgs.builder()        
            .bucket(example.getBucket())
            .build());

        }
}
import pulumi
import pulumi_aws as aws

example = aws.s3.BucketV2("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.BucketV2("example", {});
const example_entire_bucket = new aws.s3.BucketMetric("example-entire-bucket", {bucket: example.bucket});
resources:
  example:
    type: aws:s3:BucketV2
  example-entire-bucket:
    type: aws:s3:BucketMetric
    properties:
      bucket: ${example.bucket}

Add metrics configuration with S3 object filter

using Pulumi;
using Aws = Pulumi.Aws;

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

}
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := s3.NewBucketV2(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
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var example = new BucketV2("example");

        var example_filtered = new BucketMetric("example-filtered", BucketMetricArgs.builder()        
            .bucket(example.getBucket())
            .filter(BucketMetricFilter.builder()
                .prefix("documents/")
                .tags(Map.ofEntries(
                    Map.entry("priority", "high"),
                    Map.entry("class", "blue")
                ))
                .build())
            .build());

        }
}
import pulumi
import pulumi_aws as aws

example = aws.s3.BucketV2("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.BucketV2("example", {});
const example_filtered = new aws.s3.BucketMetric("example-filtered", {
    bucket: example.bucket,
    filter: {
        prefix: "documents/",
        tags: {
            priority: "high",
            "class": "blue",
        },
    },
});
resources:
  example:
    type: aws:s3:BucketV2
  example-filtered:
    type: aws:s3:BucketMetric
    properties:
      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)
public BucketMetric(String name, BucketMetricArgs args)
public BucketMetric(String name, BucketMetricArgs args, CustomResourceOptions options)
type: aws:s3:BucketMetric
properties: # The arguments to resource properties.
options: # 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.
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.
name String
The unique name of the resource.
args BucketMetricArgs
The arguments to resource properties.
options 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 Architecture and Concepts 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 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 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 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.

bucket String

The name of the bucket to put metric configuration.

filter Property Map

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.

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 string

The provider-assigned unique ID for this managed resource.

id str

The provider-assigned unique ID for this managed resource.

id String

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)
public static BucketMetric get(String name, Output<String> id, BucketMetricState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
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.
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 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 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 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.

bucket String

The name of the bucket to put metric configuration.

filter Property Map

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.

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 Map

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).

prefix String

Object prefix for filtering (singular).

tags Map

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.