Registry /
aws / aws-cdk-aws-codeguruprofiler
Install & Compatibility
Where this runs
tested against v1.204.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 30.3MB
glibcpy 3.10–3.920 runs
installs and imports cleanly · install 3.7s · import 0.000s · 31MB
29MB installed
● package 29MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
ProfilingGroup
✓ from aws_cdk.aws_codeguruprofiler import ProfilingGroup
✗ from aws_cdk.lib.aws_codeguruprofiler import ProfilingGroup
This package is for AWS CDK v1. The `aws_cdk.lib` import pattern is specific to AWS CDK v2. Ensure your entire CDK application is consistently using v1 (`aws-cdk.core` and federated packages) or v2 (`aws-cdk-lib` monolithic package).
App
✓ from aws_cdk import App
✗ from aws_cdk.App import App
For AWS CDK v1, core constructs like App and Stack are directly imported from the top-level `aws_cdk` module (which comes from `aws-cdk.core` PyPI package).
This quickstart demonstrates how to define a basic AWS CodeGuru Profiling Group using the `aws-cdk-aws-codeguruprofiler` library in a CDK v1 application. It creates a `ProfilingGroup` resource with a configurable name. Remember to set `CDK_DEFAULT_ACCOUNT` and `CDK_DEFAULT_REGION` environment variables for deployment.
import os
from aws_cdk import App, Stack, Environment
from aws_cdk import aws_codeguruprofiler as codeguruprofiler
from constructs import Construct
class CodeGuruProfilerStack(Stack):
def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
super().__init__(scope, construct_id, **kwargs)
profiling_group_name = os.environ.get("CODEGURU_PROFILING_GROUP_NAME", "MyDefaultProfilingGroup")
# Create a CodeGuru Profiling Group
profiling_group = codeguruprofiler.ProfilingGroup(
self,
"MyApplicationProfilingGroup",
profiling_group_name=profiling_group_name,
# Compute Platform is typically configured via agent or defaults to 'Default'
# For AWS Lambda, explicit configuration may be needed or a different construct.
# You can add tags, notifications, etc. here.
)
# Output the ARN of the created profiling group
# cdk.CfnOutput(self, "ProfilingGroupArn", value=profiling_group.profiling_group_arn)
app = App()
CodeGuruProfilerStack(
app,
"CodeGuruProfilerStack",
env=Environment(account=os.environ.get("CDK_DEFAULT_ACCOUNT"), region=os.environ.get("CDK_DEFAULT_REGION"))
)
app.synth()
Debug
Known issues
breakingThis package (`aws-cdk-aws-codeguruprofiler`) is part of AWS CDK v1's federated package model. It is not compatible with AWS CDK v2, which uses a single monolithic package (`aws-cdk-lib`). Trying to mix v1 and v2 packages or import patterns will lead to `ModuleNotFoundError` or deployment issues.fixMigrate your entire CDK application to v2 by installing `aws-cdk-lib` and updating imports, or ensure you are consistently using v1 by installing `aws-cdk.core` and specific service packages like this one.
affects: All versions of aws-cdk-aws-codeguruprofiler (v1) when used with aws-cdk-lib (v2).
gotchaAWS CodeGuru Profiler requires appropriate IAM permissions for the application being profiled and the CDK deployment role. Ensure your execution roles have `codeguru-profiler:ConfigureAgent`, `codeguru-profiler:PostAgentProfile`, and other necessary permissions (e.g., `codeguru-profiler:CreateProfilingGroup` for the deployment role).fixAttach an IAM policy with required CodeGuru Profiler permissions to the application's execution role and your CDK deployment role. Consider using `iam.ManagedPolicy.fromAwsManagedPolicyName('AmazonCodeGuruProfilerAgentAccess')` for the application role. affects: All versions
gotchaProfiling Group names must be unique within an AWS account and region. If you attempt to deploy a stack with a name that already exists (even from a previous failed deployment or manual creation), the deployment will fail.fixEnsure profiling group names are unique. Use a dynamic name (e.g., suffixed with a unique ID or hash) for transient environments, or explicitly delete the old profiling group before redeployment.
affects: All versions
Upgrade
Version history
1.204.0latest on PyPI · released Jun 19, 2023
Audit
Dependencies
aws-cdk.corerequiredCore AWS CDK v1 library, required for all CDK v1 constructs.
constructsrequiredBase construct library for all CDK applications.