Skip to content

Amazon CloudWatch

Description

Amazon CloudWatch enables you to publish, monitor, and manage various metrics, as well as configure alarm actions based on data from metrics. This guide provides detailed information about CloudWatch actions, data types, parameters, and errors. For more information about CloudWatch features, see Amazon CloudWatch and the Amazon CloudWatch User Guide.

For information about the metrics that other Amazon Web Services products send to CloudWatch, see the Amazon CloudWatch Metrics and Dimensions Reference in the Amazon CloudWatch User Guide.

Use the following links to get started using the CloudWatch Query API:

: An alphabetical list of all CloudWatch actions.

: An alphabetical list of all CloudWatch data types.

CommonParameters: Parameters that all Query actions can use.

CommonErrors: Client and server errors that all actions can return.

Regions and Endpoints: Supported regions and endpoints for all Amazon Web Services products.

Alternatively, you can use one of the Amazon Web Services SDKs to access CloudWatch using an API tailored to your programming language or platform.

Developers in the Amazon Web Services developer community also provide their own libraries, which you can find at the following Amazon Web Services developer centers:

Java Developer Center

JavaScript Developer Center

Amazon Web Services Mobile Services

PHP Developer Center

Python Developer Center

Ruby Developer Center

Windows and .NET Developer Center

Usage

cloudwatch(
  config = list(),
  credentials = list(),
  endpoint = NULL,
  region = NULL
)

Arguments

  • config

    Optional configuration of credentials, endpoint, and/or region.

    • credentials:
      • creds:
        • access_key_id: AWS access key ID
        • secret_access_key: AWS secret access key
        • session_token: AWS temporary session token
      • profile: The name of a profile to use. If not given, then the default profile is used.
      • anonymous: Set anonymous credentials.
    • endpoint: The complete URL to use for the constructed client.
    • region: The AWS Region used in instantiating the client.
    • close_connection: Immediately close all HTTP connections.
    • timeout: The time in seconds till a timeout exception is thrown when attempting to make a connection. The default is 60 seconds.
    • s3_force_path_style: Set this to true to force the request to use path-style addressing, i.e. http://s3.amazonaws.com/BUCKET/KEY.
    • sts_regional_endpoint: Set sts regional endpoint resolver to regional or legacy https://docs.aws.amazon.com/sdkref/latest/guide/feature-sts-regionalized-endpoints.html
    • use_dual_stack: Set this to true to use the dualstack (IPv4 and IPv6) endpoint for a service, where available, falling back to the regular endpoint when it isn't. Defaults to the AWS_USE_DUALSTACK_ENDPOINT environment variable when unset.
  • credentials

    Optional credentials shorthand for the config parameter

    • creds:
      • access_key_id: AWS access key ID
      • secret_access_key: AWS secret access key
      • session_token: AWS temporary session token
    • profile: The name of a profile to use. If not given, then the default profile is used.
    • anonymous: Set anonymous credentials.
  • endpoint

    Optional shorthand for complete URL to use for the constructed client.

  • region

    Optional shorthand for AWS Region used in instantiating the client.

Value

A client for the service. You can call the service's operations using syntax like svc$operation(...), where svc is the name you've assigned to the client. The available operations are listed in the Operations section.

Service syntax

svc <- cloudwatch(
  config = list(
    credentials = list(
      creds = list(
        access_key_id = "string",
        secret_access_key = "string",
        session_token = "string"
      ),
      profile = "string",
      anonymous = "logical"
    ),
    endpoint = "string",
    region = "string",
    close_connection = "logical",
    timeout = "numeric",
    s3_force_path_style = "logical",
    sts_regional_endpoint = "string",
    use_dual_stack = "logical"
  ),
  credentials = list(
    creds = list(
      access_key_id = "string",
      secret_access_key = "string",
      session_token = "string"
    ),
    profile = "string",
    anonymous = "logical"
  ),
  endpoint = "string",
  region = "string"
)

Operations

associate_dataset_kms_key Associates an Amazon Web Services Key Management Service (Amazon Web Services KMS) customer managed key with the specified dataset
create_resource_metrics_configuration Creates a resource metrics configuration for an Amazon Web Services resource
delete_alarm_mute_rule Deletes a specific alarm mute rule
delete_alarms Deletes the specified alarms
delete_anomaly_detector Deletes the specified anomaly detection model from your account
delete_dashboards Deletes all dashboards that you specify
delete_insight_rules Permanently deletes the specified Contributor Insights rules
delete_metric_stream Permanently deletes the metric stream that you specify
delete_resource_metrics_configuration Deletes the resource metrics configuration for an Amazon Web Services resource
describe_alarm_contributors Returns the information of the current alarm contributors that are in ALARM state
describe_alarm_history Retrieves the history for the specified alarm
describe_alarms Retrieves the specified alarms
describe_alarms_for_metric Retrieves the alarms for the specified metric
describe_anomaly_detectors Lists the anomaly detection models that you have created in your account
describe_insight_rules Returns a list of all the Contributor Insights rules in your account
disable_alarm_actions Disables the actions for the specified alarms
disable_insight_rules Disables the specified Contributor Insights rules
disassociate_dataset_kms_key Removes the customer managed Amazon Web Services Key Management Service (Amazon Web Services KMS) key association from the specified dataset
enable_alarm_actions Enables the actions for the specified alarms
enable_insight_rules Enables the specified Contributor Insights rules
get_alarm_mute_rule Retrieves details for a specific alarm mute rule
get_dashboard Displays the details of the dashboard that you specify
get_dataset Returns information about the specified dataset
get_insight_rule_report This operation returns the time series data collected by a Contributor Insights rule
get_metric_data You can use the GetMetricData API to retrieve CloudWatch metric values
get_metric_statistics Gets statistics for the specified metric
get_metric_stream Returns information about the metric stream that you specify
get_metric_widget_image You can use the GetMetricWidgetImage API to retrieve a snapshot graph of one or more Amazon CloudWatch metrics as a bitmap image
get_o_tel_enrichment Returns the current status of vended metric enrichment for the account, including whether CloudWatch vended metrics are enriched with resource ARN and resource tag labels and queryable using PromQL
get_resource_metrics_configuration Retrieves the current resource metrics configuration for an Amazon Web Services resource
list_alarm_mute_rules Lists alarm mute rules in your Amazon Web Services account and region
list_dashboards Returns a list of the dashboards for your account
list_managed_insight_rules Returns a list that contains the number of managed Contributor Insights rules in your account
list_metrics List the specified metrics
list_metric_streams Returns a list of metric streams in this account
list_tags_for_resource Displays the tags associated with a CloudWatch resource
put_alarm_mute_rule Creates or updates an alarm mute rule
put_anomaly_detector Creates an anomaly detection model for a CloudWatch metric
put_composite_alarm Creates or updates a composite alarm
put_dashboard Creates a dashboard if it does not already exist, or updates an existing dashboard
put_insight_rule Creates a Contributor Insights rule
put_log_alarm Creates or updates a log alarm
put_managed_insight_rules Creates a managed Contributor Insights rule for a specified Amazon Web Services resource
put_metric_alarm Creates or updates an alarm and associates it with the specified metric, metric math expression, anomaly detection model, Metrics Insights query, or PromQL query
put_metric_data Publishes metric data to Amazon CloudWatch
put_metric_stream Creates or updates a metric stream
set_alarm_state Temporarily sets the state of an alarm for testing purposes
start_metric_streams Starts the streaming of metrics for one or more of your metric streams
start_o_tel_enrichment Enables enrichment and PromQL access for CloudWatch vended metrics for supported Amazon Web Services resources in the account
stop_metric_streams Stops the streaming of metrics for one or more of your metric streams
stop_o_tel_enrichment Disables enrichment and PromQL access for CloudWatch vended metrics for supported Amazon Web Services resources in the account
tag_resource Assigns one or more tags (key-value pairs) to the specified CloudWatch resource
untag_resource Removes one or more tags from the specified resource
update_o_tel_enrichment Replaces the filters that determine which CloudWatch vended metrics are enriched with resource ARN and resource tag labels for the account
update_resource_metrics_configuration Updates the resource metrics configuration for an Amazon Web Services resource

Examples

svc <- cloudwatch()
svc$associate_dataset_kms_key(
  Foo = 123
)