Try AWS Native preview for resources not in the classic version.
aws.s3.BucketMetric
Explore with Pulumi AI
Try AWS Native preview for resources not in the classic version.
Provides a S3 bucket metrics configuration resource.
Example Usage
Add metrics configuration for entire S3 bucket
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.S3.BucketV2("example");
var example_entire_bucket = new Aws.S3.BucketMetric("example-entire-bucket", new()
{
Bucket = example.Id,
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/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.ID(),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.s3.BucketV2;
import com.pulumi.aws.s3.BucketMetric;
import com.pulumi.aws.s3.BucketMetricArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
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.id())
.build());
}
}
import pulumi
import pulumi_aws as aws
example = aws.s3.BucketV2("example")
example_entire_bucket = aws.s3.BucketMetric("example-entire-bucket", bucket=example.id)
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.id});
resources:
example:
type: aws:s3:BucketV2
example-entire-bucket:
type: aws:s3:BucketMetric
properties:
bucket: ${example.id}
Add metrics configuration with S3 object filter
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.S3.BucketV2("example");
var example_filtered = new Aws.S3.BucketMetric("example-filtered", new()
{
Bucket = example.Id,
Filter = new Aws.S3.Inputs.BucketMetricFilterArgs
{
Prefix = "documents/",
Tags =
{
{ "priority", "high" },
{ "class", "blue" },
},
},
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/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.ID(),
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 com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.s3.BucketV2;
import com.pulumi.aws.s3.BucketMetric;
import com.pulumi.aws.s3.BucketMetricArgs;
import com.pulumi.aws.s3.inputs.BucketMetricFilterArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
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.id())
.filter(BucketMetricFilterArgs.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.id,
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.id,
filter: {
prefix: "documents/",
tags: {
priority: "high",
"class": "blue",
},
},
});
resources:
example:
type: aws:s3:BucketV2
example-filtered:
type: aws:s3:BucketMetric
properties:
bucket: ${example.id}
filter:
prefix: documents/
tags:
priority: high
class: blue
Create 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
Name of the bucket to put metric configuration.
- Filter
Bucket
Metric Filter 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. Must be less than or equal to 64 characters in length.
- Bucket string
Name of the bucket to put metric configuration.
- Filter
Bucket
Metric Filter Args 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. Must be less than or equal to 64 characters in length.
- bucket String
Name of the bucket to put metric configuration.
- filter
Bucket
Metric Filter 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. Must be less than or equal to 64 characters in length.
- bucket string
Name of the bucket to put metric configuration.
- filter
Bucket
Metric Filter 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. Must be less than or equal to 64 characters in length.
- bucket str
Name of the bucket to put metric configuration.
- filter
Bucket
Metric Filter Args 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. Must be less than or equal to 64 characters in length.
- bucket String
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. Must be less than or equal to 64 characters in length.
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 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.
- Bucket string
Name of the bucket to put metric configuration.
- Filter
Bucket
Metric Filter 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. Must be less than or equal to 64 characters in length.
- Bucket string
Name of the bucket to put metric configuration.
- Filter
Bucket
Metric Filter Args 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. Must be less than or equal to 64 characters in length.
- bucket String
Name of the bucket to put metric configuration.
- filter
Bucket
Metric Filter 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. Must be less than or equal to 64 characters in length.
- bucket string
Name of the bucket to put metric configuration.
- filter
Bucket
Metric Filter 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. Must be less than or equal to 64 characters in length.
- bucket str
Name of the bucket to put metric configuration.
- filter
Bucket
Metric Filter Args 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. Must be less than or equal to 64 characters in length.
- bucket String
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. Must be less than or equal to 64 characters in length.
Supporting Types
BucketMetricFilter, BucketMetricFilterArgs
- Prefix string
Object prefix for filtering (singular).
- Dictionary<string, string>
Object tags for filtering (up to 10).
- Prefix string
Object prefix for filtering (singular).
- map[string]string
Object tags for filtering (up to 10).
- prefix String
Object prefix for filtering (singular).
- Map<String,String>
Object tags for filtering (up to 10).
- prefix string
Object prefix for filtering (singular).
- {[key: string]: string}
Object tags for filtering (up to 10).
- prefix str
Object prefix for filtering (singular).
- Mapping[str, str]
Object tags for filtering (up to 10).
- prefix String
Object prefix for filtering (singular).
- Map<String>
Object tags for filtering (up to 10).
Import
Using pulumi import
, import S3 bucket metric configurations using bucket:metric
. For example:
$ pulumi import aws:s3/bucketMetric:BucketMetric my-bucket-entire-bucket my-bucket:EntireBucket
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
aws
Terraform Provider.
Try AWS Native preview for resources not in the classic version.