CloudWatch RUM

2025/03/03 - CloudWatch RUM - 3 new1 updated api methods

Changes  Add support for PutResourcePolicy, GetResourcePolicy and DeleteResourcePolicy to support resource based policies for AWS CloudWatch RUM

GetResourcePolicy (new) Link ¶

Use this operation to retrieve information about a resource-based policy that is attached to an app monitor.

See also: AWS API Documentation

Request Syntax

client.get_resource_policy(
    Name='string'
)
type Name:

string

param Name:

[REQUIRED]

The name of the app monitor that is associated with the resource-based policy that you want to view.

rtype:

dict

returns:

Response Syntax

{
    'PolicyDocument': 'string',
    'PolicyRevisionId': 'string'
}

Response Structure

  • (dict) --

    • PolicyDocument (string) --

      The JSON policy document that you requested.

    • PolicyRevisionId (string) --

      The revision ID information for this version of the policy document that you requested.

DeleteResourcePolicy (new) Link ¶

Removes the association of a resource-based policy from an app monitor.

See also: AWS API Documentation

Request Syntax

client.delete_resource_policy(
    Name='string',
    PolicyRevisionId='string'
)
type Name:

string

param Name:

[REQUIRED]

The app monitor that you want to remove the resource policy from.

type PolicyRevisionId:

string

param PolicyRevisionId:

Specifies a specific policy revision to delete. Provide a PolicyRevisionId to ensure an atomic delete operation. If the revision ID that you provide doesn't match the latest policy revision ID, the request will be rejected with an InvalidPolicyRevisionIdException error.

rtype:

dict

returns:

Response Syntax

{
    'PolicyRevisionId': 'string'
}

Response Structure

  • (dict) --

    • PolicyRevisionId (string) --

      The revision ID of the policy that was removed, if it had one.

PutResourcePolicy (new) Link ¶

Use this operation to assign a resource-based policy to a CloudWatch RUM app monitor to control access to it. Each app monitor can have one resource-based policy. The maximum size of the policy is 4 KB. To learn more about using resource policies with RUM, see Using resource-based policies with CloudWatch RUM.

See also: AWS API Documentation

Request Syntax

client.put_resource_policy(
    Name='string',
    PolicyDocument='string',
    PolicyRevisionId='string'
)
type Name:

string

param Name:

[REQUIRED]

The name of the app monitor that you want to apply this resource-based policy to. To find the names of your app monitors, you can use the ListAppMonitors operation.

type PolicyDocument:

string

param PolicyDocument:

[REQUIRED]

The JSON to use as the resource policy. The document can be up to 4 KB in size. For more information about the contents and syntax for this policy, see Using resource-based policies with CloudWatch RUM.

type PolicyRevisionId:

string

param PolicyRevisionId:

A string value that you can use to conditionally update your policy. You can provide the revision ID of your existing policy to make mutating requests against that policy.

When you assign a policy revision ID, then later requests about that policy will be rejected with an InvalidPolicyRevisionIdException error if they don't provide the correct current revision ID.

rtype:

dict

returns:

Response Syntax

{
    'PolicyDocument': 'string',
    'PolicyRevisionId': 'string'
}

Response Structure

  • (dict) --

    • PolicyDocument (string) --

      The JSON policy document that you specified.

    • PolicyRevisionId (string) --

      The policy revision ID information that you specified.

PutRumEvents (updated) Link ¶
Changes (request)
{'Alias': 'string'}

Sends telemetry events about your application performance and user behavior to CloudWatch RUM. The code snippet that RUM generates for you to add to your application includes PutRumEvents operations to send this data to RUM.

Each PutRumEvents operation can send a batch of events from one user session.

See also: AWS API Documentation

Request Syntax

client.put_rum_events(
    Alias='string',
    AppMonitorDetails={
        'id': 'string',
        'name': 'string',
        'version': 'string'
    },
    BatchId='string',
    Id='string',
    RumEvents=[
        {
            'details': 'string',
            'id': 'string',
            'metadata': 'string',
            'timestamp': datetime(2015, 1, 1),
            'type': 'string'
        },
    ],
    UserDetails={
        'sessionId': 'string',
        'userId': 'string'
    }
)
type Alias:

string

param Alias:

If the app monitor uses a resource-based policy that requires PutRumEvents requests to specify a certain alias, specify that alias here. This alias will be compared to the rum:alias context key in the resource-based policy. For more information, see Using resource-based policies with CloudWatch RUM.

type AppMonitorDetails:

dict

param AppMonitorDetails:

[REQUIRED]

A structure that contains information about the app monitor that collected this telemetry information.

  • id (string) --

    The unique ID of the app monitor.

  • name (string) --

    The name of the app monitor.

  • version (string) --

    The version of the app monitor.

type BatchId:

string

param BatchId:

[REQUIRED]

A unique identifier for this batch of RUM event data.

type Id:

string

param Id:

[REQUIRED]

The ID of the app monitor that is sending this data.

type RumEvents:

list

param RumEvents:

[REQUIRED]

An array of structures that contain the telemetry event data.

  • (dict) --

    A structure that contains the information for one performance event that RUM collects from a user session with your application.

    • details (string) -- [REQUIRED]

      A string containing details about the event.

    • id (string) -- [REQUIRED]

      A unique ID for this event.

    • metadata (string) --

      Metadata about this event, which contains a JSON serialization of the identity of the user for this session. The user information comes from information such as the HTTP user-agent request header and document interface.

    • timestamp (datetime) -- [REQUIRED]

      The exact time that this event occurred.

    • type (string) -- [REQUIRED]

      The JSON schema that denotes the type of event this is, such as a page load or a new session.

type UserDetails:

dict

param UserDetails:

[REQUIRED]

A structure that contains information about the user session that this batch of events was collected from.

  • sessionId (string) --

    The session ID that the performance events are from.

  • userId (string) --

    The ID of the user for this user session. This ID is generated by RUM and does not include any personally identifiable information about the user.

rtype:

dict

returns:

Response Syntax

{}

Response Structure

  • (dict) --