CreateResourceMetricsConfiguration
Creates a resource metrics configuration for an AWS resource. After you create a configuration, Amazon CloudWatch collects detailed metrics for that resource.
Each AWS resource can have only one resource metrics configuration. If a
configuration already exists for the specified resource ARN, this operation returns a
ConflictException. To modify an existing configuration, use UpdateResourceMetricsConfiguration.
If the AWS resource that you specify in ResourceArn does
not exist, this operation returns a ResourceNotFoundException. Verify that
the resource ARN is correct and that the resource exists before you retry the
request.
To create a resource metrics configuration, you must have the
cloudwatch:CreateResourceMetricsConfiguration permission. For information about scoping
this permission to specific resources, see Condition keys for resource metrics configuration access in the
Amazon CloudWatch User Guide.
Request Parameters
- MetricSelections
-
Specifies which metrics Amazon CloudWatch collects for the resource. If you omit this parameter, Amazon CloudWatch collects all available detailed metrics for the resource.
Type: Array of ResourceMetricSelection objects
Array Members: Fixed number of 1 item.
Required: No
- ResourceArn
-
The Amazon Resource Name (ARN) of the AWS resource to enable detailed monitoring for.
Type: String
Length Constraints: Minimum length of 20. Maximum length of 2048.
Pattern:
arn:[a-zA-Z0-9-]+:[a-zA-Z0-9-]+:[a-zA-Z0-9-]*:\d{12}:.+Required: Yes
Response Elements
The following element is returned by the service.
- ResourceMetricsConfiguration
-
The resource metrics configuration that was created by this operation.
Type: ResourceMetricsConfiguration object
Errors
For information about the errors that are common to all actions, see Common Error Types.
- ConflictException
-
This operation attempted to create a resource that already exists.
HTTP Status Code: 409
- ResourceNotFoundException
-
The named resource does not exist.
HTTP Status Code: 404
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: