AWS CDK CodeGuru Profiler (v1)

1.204.0 · maintenance · verified Thu Apr 16

The `aws-cdk-aws-codeguruprofiler` library provides AWS CDK (v1) constructs for provisioning AWS CodeGuru Profiler resources. It simplifies the creation and management of profiling groups and related configurations within your CDK applications. This entry is for CDK v1, with the current version being 1.204.0. AWS CDK typically follows a rapid release cadence, often aligning with AWS service updates.

Common errors

Warnings

Install

Imports

Quickstart

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()

view raw JSON →