class CodeInterpreterCustom (construct)
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.Bedrock.Agentcore.Alpha.CodeInterpreterCustom |
Go | github.com/aws/aws-cdk-go/awsbedrockagentcorealpha/v2#CodeInterpreterCustom |
Java | software.amazon.awscdk.services.bedrock.agentcore.alpha.CodeInterpreterCustom |
Python | aws_cdk.aws_bedrock_agentcore_alpha.CodeInterpreterCustom |
TypeScript (source) | @aws-cdk/aws-bedrock-agentcore-alpha » CodeInterpreterCustom |
Implements
IConstruct, IDependable, IResource, IEnvironment, ICode, IGrantable, IConnectable, ICode
Custom code interpreter resource for AWS Bedrock Agent Core.
Provides a sandboxed environment for code execution with configurable network access.
See also: https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/code-interpreter.html
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as bedrock_agentcore_alpha from '@aws-cdk/aws-bedrock-agentcore-alpha';
import { aws_iam as iam } from 'aws-cdk-lib';
declare const codeInterpreterNetworkConfiguration: bedrock_agentcore_alpha.CodeInterpreterNetworkConfiguration;
declare const role: iam.Role;
const codeInterpreterCustom = new bedrock_agentcore_alpha.CodeInterpreterCustom(this, 'MyCodeInterpreterCustom', /* all optional props */ {
codeInterpreterCustomName: 'codeInterpreterCustomName',
description: 'description',
executionRole: role,
networkConfiguration: codeInterpreterNetworkConfiguration,
tags: {
tagsKey: 'tags',
},
});
Initializer
new CodeInterpreterCustom(scope: Construct, id: string, props?: CodeInterpreterCustomProps)
Parameters
- scope
Construct - id
string - props
CodeInterpreter Custom Props
Construct Props
| Name | Type | Description |
|---|---|---|
| code | string | The name of the code interpreter Valid characters are a-z, A-Z, 0-9, _ (underscore) The name must start with a letter and can be up to 48 characters long Pattern: [a-zA-Z][a-zA-Z0-9_]{0,47}. |
| description? | string | Optional description for the code interpreter Valid characters are a-z, A-Z, 0-9, _ (underscore), - (hyphen) and spaces The description can have up to 200 characters. |
| execution | IRole | The IAM role that provides permissions for the code interpreter to access AWS services. |
| network | Code | Network configuration for code interpreter. |
| tags? | { [string]: string } | Tags (optional) A list of key:value pairs of tags to apply to this Code Interpreter resource. |
codeInterpreterCustomName?
⚠️ Deprecated: Use the equivalent construct from aws-cdk-lib/aws-bedrockagentcore instead.
Type:
string
(optional, default: auto generate)
The name of the code interpreter Valid characters are a-z, A-Z, 0-9, _ (underscore) The name must start with a letter and can be up to 48 characters long Pattern: [a-zA-Z][a-zA-Z0-9_]{0,47}.
description?
⚠️ Deprecated: Use the equivalent construct from aws-cdk-lib/aws-bedrockagentcore instead.
Type:
string
(optional, default: No description)
Optional description for the code interpreter Valid characters are a-z, A-Z, 0-9, _ (underscore), - (hyphen) and spaces The description can have up to 200 characters.
executionRole?
⚠️ Deprecated: Use the equivalent construct from aws-cdk-lib/aws-bedrockagentcore instead.
Type:
IRole
(optional, default: A new role will be created.)
The IAM role that provides permissions for the code interpreter to access AWS services.
networkConfiguration?
⚠️ Deprecated: Use the equivalent construct from aws-cdk-lib/aws-bedrockagentcore instead.
Type:
Code
(optional, default: PUBLIC network mode)
Network configuration for code interpreter.
tags?
⚠️ Deprecated: Use the equivalent construct from aws-cdk-lib/aws-bedrockagentcore instead.
Type:
{ [string]: string }
(optional, default: {} - no tags)
Tags (optional) A list of key:value pairs of tags to apply to this Code Interpreter resource.
Properties
| Name | Type | Description |
|---|---|---|
| code | string | The ARN of the code interpreter resource. |
| code | Code | A reference to a CodeInterpreterCustom resource. |
| code | string | The id of the code interpreter. |
| connections | Connections | An accessor for the Connections object that will fail if this Browser does not have a VPC configured. |
| env | Resource | The environment this resource belongs to. |
| execution | IRole | The IAM role that provides permissions for the code interpreter to access AWS services. |
| grant | IPrincipal | The principal to grant permissions to. |
| name | string | The name of the code interpreter. |
| network | Code | The network configuration of the code interpreter. |
| node | Node | The tree node. |
| stack | Stack | The stack in which this resource is defined. |
| created | string | The created timestamp of the code interpreter. |
| description? | string | The description of the code interpreter. |
| failure | string | The failure reason of the code interpreter. |
| last | string | The last updated timestamp of the code interpreter. |
| status? | string | The status of the code interpreter. |
| tags? | { [string]: string } | Tags applied to this code interpreter resource A map of key-value pairs for resource tagging. |
| static PROPERTY_INJECTION_ID | string | Uniquely identifies this class. |
codeInterpreterArn
Type:
string
The ARN of the code interpreter resource.
codeInterpreterCustomRef
⚠️ Deprecated: undefined
Type:
Code
A reference to a CodeInterpreterCustom resource.
codeInterpreterId
Type:
string
The id of the code interpreter.
connections
⚠️ Deprecated: undefined
Type:
Connections
An accessor for the Connections object that will fail if this Browser does not have a VPC configured.
env
Type:
Resource
The environment this resource belongs to.
For resources that are created and managed in a Stack (those created by
creating new class instances like new Role(), new Bucket(), etc.), this
is always the same as the environment of the stack they belong to.
For referenced resources (those obtained from referencing methods like
Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be
different than the stack they were imported into.
executionRole
Type:
IRole
The IAM role that provides permissions for the code interpreter to access AWS services.
grantPrincipal
Type:
IPrincipal
The principal to grant permissions to.
name
Type:
string
The name of the code interpreter.
networkConfiguration
Type:
Code
The network configuration of the code interpreter.
node
Type:
Node
The tree node.
stack
Type:
Stack
The stack in which this resource is defined.
createdAt?
Type:
string
(optional)
The created timestamp of the code interpreter.
description?
Type:
string
(optional)
The description of the code interpreter.
failureReason?
Type:
string
(optional)
The failure reason of the code interpreter.
lastUpdatedAt?
Type:
string
(optional)
The last updated timestamp of the code interpreter.
status?
Type:
string
(optional)
The status of the code interpreter.
tags?
Type:
{ [string]: string }
(optional, default: No tags applied)
Tags applied to this code interpreter resource A map of key-value pairs for resource tagging.
static PROPERTY_INJECTION_ID
Type:
string
Uniquely identifies this class.
Methods
| Name | Description |
|---|---|
| apply | Override the cross-stack reference strength for this resource. |
| apply | Apply the given removal policy to this resource. |
| grant(grantee, ...actions) | Grants IAM actions to the IAM Principal. |
| grant | Grant invoke permissions on this code interpreter to an IAM principal. |
| grant | Grant read permissions on this code interpreter to an IAM principal. |
| grant | Grant invoke permissions on this code interpreter to an IAM principal. |
| metric(metricName, dimensions, props?) | Return the given named metric for this code interpreter. |
| metric | Creates a CloudWatch metric for tracking code interpreter errors. |
| metric | Creates a CloudWatch metric for tracking code interpreter api operations.. |
| metric | Creates a CloudWatch metric for tracking code interpreter invocations. |
| metric | Creates a CloudWatch metric for tracking code interpreter latencies. |
| metric | Creates a CloudWatch metric for tracking code interpreter session duration. |
| metric | Creates a CloudWatch metric for tracking code interpreter system errors. |
| metric | Creates a CloudWatch metric for tracking code interpreter throttles. |
| metric | Creates a CloudWatch metric for tracking code interpreter user errors. |
| to | Returns a string representation of this construct. |
| with(...mixins) | Applies one or more mixins to this construct. |
| static from | Creates an Code Interpreter Custom reference from an existing code interpreter's attributes. |
applyCrossStackReferenceStrength(strength)
public applyCrossStackReferenceStrength(strength: ReferenceStrength): void
Parameters
- strength
Reference— - The reference strength to use for this resource.Strength
Override the cross-stack reference strength for this resource.
When set, any cross-stack reference to this resource will use the specified
mechanism instead of the global default determined by the
@aws-cdk/core:defaultCrossStackReferences context key. This is useful for
selectively weakening specific references to avoid the "deadly embrace" problem
without changing the app-wide default.
applyRemovalPolicy(policy)
public applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
RemovalPolicy
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS
account for data recovery and cleanup later (RemovalPolicy.RETAIN).
grant(grantee, ...actions)
public grant(grantee: IGrantable, ...actions: string[]): Grant
⚠️ Deprecated: undefined
Parameters
- grantee
IGrantable— - The IAM principal to grant permissions to. - actions
string— - The actions to grant.
Returns
Grants IAM actions to the IAM Principal.
[disable-awslint:no-grants]
grantInvoke(grantee)
public grantInvoke(grantee: IGrantable): Grant
⚠️ Deprecated: undefined
Parameters
- grantee
IGrantable— - The IAM principal to grant invoke permissions to.
Returns
Grant invoke permissions on this code interpreter to an IAM principal.
[disable-awslint:no-grants]
grantRead(grantee)
public grantRead(grantee: IGrantable): Grant
⚠️ Deprecated: undefined
Parameters
- grantee
IGrantable— - The IAM principal to grant read permissions to.
Returns
Grant read permissions on this code interpreter to an IAM principal.
This includes both read permissions on the specific code interpreter and list permissions on all code interpreters.
[disable-awslint:no-grants]
grantUse(grantee)
public grantUse(grantee: IGrantable): Grant
⚠️ Deprecated: undefined
Parameters
- grantee
IGrantable— - The IAM principal to grant invoke permissions to.
Returns
Grant invoke permissions on this code interpreter to an IAM principal.
[disable-awslint:no-grants]
metric(metricName, dimensions, props?)
public metric(metricName: string, dimensions: { [string]: string }, props?: MetricOptions): Metric
⚠️ Deprecated: undefined
Parameters
- metricName
string - dimensions
{ [string]: string } - props
MetricOptions
Returns
Return the given named metric for this code interpreter.
By default, the metric will be calculated as a sum over a period of 5 minutes.
You can customize this by using the statistic and period properties.
metricErrorsForApiOperation(operation, props?)
public metricErrorsForApiOperation(operation: string, props?: MetricOptions): Metric
⚠️ Deprecated: undefined
Parameters
- operation
string - props
Metric— - Configuration options for the metric.Options
Returns
Creates a CloudWatch metric for tracking code interpreter errors.
metricForApiOperation(metricName, operation, props?)
public metricForApiOperation(metricName: string, operation: string, props?: MetricOptions): Metric
⚠️ Deprecated: undefined
Parameters
- metricName
string - operation
string - props
Metric— - Configuration options for the metric.Options
Returns
Creates a CloudWatch metric for tracking code interpreter api operations..
metricInvocationsForApiOperation(operation, props?)
public metricInvocationsForApiOperation(operation: string, props?: MetricOptions): Metric
⚠️ Deprecated: undefined
Parameters
- operation
string - props
Metric— - Configuration options for the metric.Options
Returns
Creates a CloudWatch metric for tracking code interpreter invocations.
metricLatencyForApiOperation(operation, props?)
public metricLatencyForApiOperation(operation: string, props?: MetricOptions): Metric
⚠️ Deprecated: undefined
Parameters
- operation
string - props
Metric— - Configuration options for the metric.Options
Returns
Creates a CloudWatch metric for tracking code interpreter latencies.
metricSessionDuration(props?)
public metricSessionDuration(props?: MetricOptions): Metric
⚠️ Deprecated: undefined
Parameters
- props
Metric— - Configuration options for the metric.Options
Returns
Creates a CloudWatch metric for tracking code interpreter session duration.
metricSystemErrorsForApiOperation(operation, props?)
public metricSystemErrorsForApiOperation(operation: string, props?: MetricOptions): Metric
⚠️ Deprecated: undefined
Parameters
- operation
string - props
Metric— - Configuration options for the metric.Options
Returns
Creates a CloudWatch metric for tracking code interpreter system errors.
metricThrottlesForApiOperation(operation, props?)
public metricThrottlesForApiOperation(operation: string, props?: MetricOptions): Metric
⚠️ Deprecated: undefined
Parameters
- operation
string - props
Metric— - Configuration options for the metric.Options
Returns
Creates a CloudWatch metric for tracking code interpreter throttles.
metricUserErrorsForApiOperation(operation, props?)
public metricUserErrorsForApiOperation(operation: string, props?: MetricOptions): Metric
⚠️ Deprecated: undefined
Parameters
- operation
string - props
Metric— - Configuration options for the metric.Options
Returns
Creates a CloudWatch metric for tracking code interpreter user errors.
toString()
public toString(): string
Returns
string
Returns a string representation of this construct.
with(...mixins)
public with(...mixins: IMixin[]): IConstruct
Parameters
- mixins
IMixin
Returns
Applies one or more mixins to this construct.
Mixins are applied in order. The list of constructs is captured at the
start of the call, so constructs added by a mixin will not be visited.
Use multiple with() calls if subsequent mixins should apply to added
constructs.
static fromCodeInterpreterCustomAttributes(scope, id, attrs)
public static fromCodeInterpreterCustomAttributes(scope: Construct, id: string, attrs: CodeInterpreterCustomAttributes): ICodeInterpreterCustom
Parameters
- scope
Construct— - The construct scope. - id
string— - Identifier of the construct. - attrs
Code— - Attributes of the existing code interpreter custom.Interpreter Custom Attributes
Returns
Creates an Code Interpreter Custom reference from an existing code interpreter's attributes.

.NET
Go
Java
Python
TypeScript (