AWS::CodeGuruProfiler Construct Library

---

End-of-Support

AWS CDK v1 has reached End-of-Support on 2023-06-01. This package is no longer being updated, and users should migrate to AWS CDK v2.

For more information on how to migrate, see the Migrating to AWS CDK v2 guide.


Amazon CodeGuru Profiler collects runtime performance data from your live applications, and provides recommendations that can help you fine-tune your application performance.

Installation

Import to your project:

import aws_cdk.aws_codeguruprofiler as codeguruprofiler

Basic usage

Here’s how to setup a profiling group and give your compute role permissions to publish to the profiling group to the profiling agent can publish profiling information:

# The execution role of your application that publishes to the ProfilingGroup via CodeGuru Profiler Profiling Agent. (the following is merely an example)
publish_app_role = iam.Role(self, "PublishAppRole",
    assumed_by=iam.AccountRootPrincipal()
)

profiling_group = codeguruprofiler.ProfilingGroup(self, "MyProfilingGroup")
profiling_group.grant_publish(publish_app_role)

Compute Platform configuration

Code Guru Profiler supports multiple compute environments. They can be configured when creating a Profiling Group by using the computePlatform property:

profiling_group = codeguruprofiler.ProfilingGroup(self, "MyProfilingGroup",
    compute_platform=codeguruprofiler.ComputePlatform.AWS_LAMBDA
)