Package com.pulumi.aws.cloudwatch
Class ResourceMetricsConfiguration
- java.lang.Object
-
- com.pulumi.resources.Resource
-
- com.pulumi.resources.CustomResource
-
- com.pulumi.aws.cloudwatch.ResourceMetricsConfiguration
-
public class ResourceMetricsConfiguration extends com.pulumi.resources.CustomResourceManages a CloudWatch resource metrics configuration. Creating a configuration makes CloudWatch collect detailed metrics for the targeted AWS resource. Each AWS resource can have at most one resource metrics configuration. Detailed metrics incur charges, so limit collection with `metricSelection` when you only need a subset of metrics. See [Amazon CloudWatch pricing](https://aws.amazon.com/cloudwatch/pricing/) for details. > **Note:** Not every AWS resource type is eligible for detailed metrics. At the time of writing, only Amazon ElastiCache replication groups are supported. Targeting any other resource type, including ElastiCache serverless caches and cache clusters, returns a `ValidationError` with the message `Unsupported resource type`. ## Example Usage ### Basic Usage Omit `metricSelection` to collect every detailed metric that is available for the resource.
### Collect Selected Metricspackage generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.elasticache.ReplicationGroup; import com.pulumi.aws.elasticache.ReplicationGroupArgs; import com.pulumi.aws.cloudwatch.ResourceMetricsConfiguration; import com.pulumi.aws.cloudwatch.ResourceMetricsConfigurationArgs; import java.util.ArrayList; import java.util.Arrays; 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 ReplicationGroup("example", ReplicationGroupArgs.builder() .replicationGroupId("example") .description("example") .engine("valkey") .nodeType("cache.t3.small") .numCacheClusters(1) .build()); var exampleResourceMetricsConfiguration = new ResourceMetricsConfiguration("exampleResourceMetricsConfiguration", ResourceMetricsConfigurationArgs.builder() .resourceArn(example.arn()) .build()); } }
## Import ### Identity Schema #### Required * `resourceArn` - ARN of the AWS resource that the resource metrics configuration applies to. Using `pulumi import`, import a CloudWatch resource metrics configuration using the `resourceArn`. For example: ```sh $ pulumi import aws:cloudwatch/resourceMetricsConfiguration:ResourceMetricsConfiguration example arn:aws:elasticache:us-west-2:012345678901:replicationgroup:example ```package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.cloudwatch.ResourceMetricsConfiguration; import com.pulumi.aws.cloudwatch.ResourceMetricsConfigurationArgs; import com.pulumi.aws.cloudwatch.inputs.ResourceMetricsConfigurationMetricSelectionArgs; import java.util.ArrayList; import java.util.Arrays; 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 ResourceMetricsConfiguration("example", ResourceMetricsConfigurationArgs.builder() .metricSelection(ResourceMetricsConfigurationMetricSelectionArgs.builder() .includeMetrics( "valkey.memory.used", "valkey.commands.processed") .build()) .resourceArn(exampleAwsElasticacheReplicationGroup.arn()) .build()); } }
-
-
Constructor Summary
Constructors Constructor Description ResourceMetricsConfiguration(java.lang.String name)ResourceMetricsConfiguration(java.lang.String name, ResourceMetricsConfigurationArgs args)ResourceMetricsConfiguration(java.lang.String name, ResourceMetricsConfigurationArgs args, com.pulumi.resources.CustomResourceOptions options)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ResourceMetricsConfigurationget(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, ResourceMetricsConfigurationState state, com.pulumi.resources.CustomResourceOptions options)Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.com.pulumi.core.Output<java.util.Optional<ResourceMetricsConfigurationMetricSelection>>metricSelection()com.pulumi.core.Output<java.lang.String>region()com.pulumi.core.Output<java.lang.String>resourceArn()
-
-
-
Constructor Detail
-
ResourceMetricsConfiguration
public ResourceMetricsConfiguration(java.lang.String name)
- Parameters:
name- The _unique_ name of the resulting resource.
-
ResourceMetricsConfiguration
public ResourceMetricsConfiguration(java.lang.String name, ResourceMetricsConfigurationArgs args)- Parameters:
name- The _unique_ name of the resulting resource.args- The arguments to use to populate this resource's properties.
-
ResourceMetricsConfiguration
public ResourceMetricsConfiguration(java.lang.String name, ResourceMetricsConfigurationArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options)- Parameters:
name- The _unique_ name of the resulting resource.args- The arguments to use to populate this resource's properties.options- A bag of options that control this resource's behavior.
-
-
Method Detail
-
metricSelection
public com.pulumi.core.Output<java.util.Optional<ResourceMetricsConfigurationMetricSelection>> metricSelection()
- Returns:
- Configuration block that limits which metrics CloudWatch collects. At most one block is supported. When omitted, CloudWatch collects all available detailed metrics for the resource. See `metricSelection` below.
-
region
public com.pulumi.core.Output<java.lang.String> region()
- Returns:
- Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
-
resourceArn
public com.pulumi.core.Output<java.lang.String> resourceArn()
- Returns:
- ARN of the AWS resource to enable detailed monitoring for. Changing this forces a new resource to be created. The following arguments are optional:
-
get
public static ResourceMetricsConfiguration get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, @Nullable ResourceMetricsConfigurationState state, @Nullable com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.- Parameters:
name- The _unique_ name of the resulting resource.id- The _unique_ provider ID of the resource to lookup.state-options- Optional settings to control the behavior of the CustomResource.
-
-