Skip to content
v2.274.0

AWS::CodeGuruProfiler Construct Library ​

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:

ts
import * as codeguruprofiler from 'aws-cdk-lib/aws-codeguruprofiler';
python
import aws_cdk.aws_codeguruprofiler as codeguruprofiler
java
import software.amazon.awscdk.services.codeguruprofiler.*;
csharp
using Amazon.CDK.AWS.CodeGuruProfiler;
go
import codeguruprofiler "github.com/aws/aws-cdk-go/awscdk"

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:

ts
// The execution role of your application that publishes to the ProfilingGroup via CodeGuru Profiler Profiling Agent. (the following is merely an example)
const publishAppRole = new iam.Role(this, 'PublishAppRole', {
  assumedBy: new iam.AccountRootPrincipal(),
});

const profilingGroup = new codeguruprofiler.ProfilingGroup(this, 'MyProfilingGroup');
profilingGroup.grantPublish(publishAppRole);
python
# 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)
java
// The execution role of your application that publishes to the ProfilingGroup via CodeGuru Profiler Profiling Agent. (the following is merely an example)
Role publishAppRole = Role.Builder.create(this, "PublishAppRole")
        .assumedBy(new AccountRootPrincipal())
        .build();

ProfilingGroup profilingGroup = new ProfilingGroup(this, "MyProfilingGroup");
profilingGroup.grantPublish(publishAppRole);
csharp
// The execution role of your application that publishes to the ProfilingGroup via CodeGuru Profiler Profiling Agent. (the following is merely an example)
var publishAppRole = new Role(this, "PublishAppRole", new RoleProps {
    AssumedBy = new AccountRootPrincipal()
});

var profilingGroup = new ProfilingGroup(this, "MyProfilingGroup");
profilingGroup.GrantPublish(publishAppRole);
go
// The execution role of your application that publishes to the ProfilingGroup via CodeGuru Profiler Profiling Agent. (the following is merely an example)
publishAppRole := iam.NewRole(this, jsii.String("PublishAppRole"), &RoleProps{
	AssumedBy: iam.NewAccountRootPrincipal(),
})

profilingGroup := codeguruprofiler.NewProfilingGroup(this, jsii.String("MyProfilingGroup"))
profilingGroup.grantPublish(publishAppRole)

Compute Platform configuration ​

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

ts
const profilingGroup = new codeguruprofiler.ProfilingGroup(this, 'MyProfilingGroup', {
  computePlatform: codeguruprofiler.ComputePlatform.AWS_LAMBDA,
});
python
profiling_group = codeguruprofiler.ProfilingGroup(self, "MyProfilingGroup",
    compute_platform=codeguruprofiler.ComputePlatform.AWS_LAMBDA
)
java
ProfilingGroup profilingGroup = ProfilingGroup.Builder.create(this, "MyProfilingGroup")
        .computePlatform(ComputePlatform.AWS_LAMBDA)
        .build();
csharp
var profilingGroup = new ProfilingGroup(this, "MyProfilingGroup", new ProfilingGroupProps {
    ComputePlatform = ComputePlatform.AWS_LAMBDA
});
go
profilingGroup := codeguruprofiler.NewProfilingGroup(this, jsii.String("MyProfilingGroup"), &ProfilingGroupProps{
	ComputePlatform: codeguruprofiler.ComputePlatform_AWS_LAMBDA,
})

Types ​

NameKindSummary
ProfilingGroupConstruct (L2)A new Profiling Group.
CfnProfilingGroupConstruct (L1)Creates a profiling group.
CfnProfilingGroup.AgentPermissionsPropertyStructThe agent permissions attached to this profiling group.
CfnProfilingGroup.ChannelPropertyStructNotification medium for users to get alerted for events that occur in application profile.
CfnProfilingGroupPropsStructProperties for defining a CfnProfilingGroup.
ComputePlatformEnumThe compute platform of the profiling group.
IProfilingGroupInterfaceIResource represents a Profiling Group.
ProfilingGroupGrantsFacadeCollection of grant methods for a IProfilingGroupRef.
ProfilingGroupPropsStructProperties for creating a new Profiling Group.