aws-observability / aws-rum-web

Amazon CloudWatch RUM Web Client
Apache License 2.0
114 stars 65 forks source link

[Feature Request][CDK]: Allow property customization with resource delegation #553

Open ShawneeY opened 1 month ago

ShawneeY commented 1 month ago

Please provide your feature request

Problem:

When creating AWS::RUM::AppMonitor using CDK, we can omit passing AppMonitorConfiguration and let RUM create identityPool and anonymous guest IAM role. However, it would apply default values for other properties; e.g. the sample rate used for CloudWatch RUM is set to 10% of the user sessions.

On the other hand, when a AppMonitorConfiguration is supplied but guestRoleArn and identityPoolId are omitted:

appMonitorConfiguration: {
    allowCookies: true,
    enableXRay: true,
    telemetries: ['errors', 'performance', 'http'],
    sessionSampleRate: 1,
},

Then the created AppMonitor is configured to use private authentication from existing provider. This is somewhat unexpected.

Desired feature

Allow customize AppMonitor via appMonitorConfiguration but still delegate creation of IdentityPool and GuestRole to RUM's internal logic(A.K.A option 1 from the attached screenshot): AppMonitorAuthorizationConfig

In other words, it would be much clearer to set authorization option explicitly in CDK instead of inferring implicitly.