class ApplicationInferenceProfile (construct)
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.Bedrock.Alpha.ApplicationInferenceProfile |
![]() | github.com/aws/aws-cdk-go/awsbedrockalpha/v2#ApplicationInferenceProfile |
![]() | software.amazon.awscdk.services.bedrock.alpha.ApplicationInferenceProfile |
![]() | aws_cdk.aws_bedrock_alpha.ApplicationInferenceProfile |
![]() | @aws-cdk/aws-bedrock-alpha ยป ApplicationInferenceProfile |
Implements
IConstruct
, IDependable
, IResource
, IInference
, IBedrock
Class to create an Application Inference Profile with CDK.
These are inference profiles created by users (user defined). This helps to track costs and model usage.
Application inference profiles are user-defined profiles that help you track costs and model usage. They can be created for a single region or for multiple regions using a cross-region inference profile.
Example
// Create a cross-region inference profile
const crossRegionProfile = bedrock.CrossRegionInferenceProfile.fromConfig({
geoRegion: bedrock.CrossRegionInferenceProfileRegion.US,
model: bedrock.BedrockFoundationModel.ANTHROPIC_CLAUDE_3_5_SONNET_V2_0,
});
// Create an application inference profile across regions
const appProfile = new bedrock.ApplicationInferenceProfile(this, 'MyMultiRegionProfile', {
applicationInferenceProfileName: 'claude-35-sonnet-v2-multi-region',
modelSource: crossRegionProfile,
description: 'Multi-region application profile for cost tracking',
});
Initializer
new ApplicationInferenceProfile(scope: Construct, id: string, props: ApplicationInferenceProfileProps)
Parameters
- scope
Construct
- id
string
- props
Application
Inference Profile Props
Construct Props
Name | Type | Description |
---|---|---|
application | string | The name of the application inference profile. |
model | IBedrock | The model source for this inference profile. |
description? | string | Description of the inference profile. Provides additional context about the purpose and usage of this inference profile. |
tags? | { [string]: string } | A list of tags associated with the inference profile. |
applicationInferenceProfileName
Type:
string
The name of the application inference profile.
This name will be used to identify the inference profile in the AWS console and APIs.
- Required: Yes
- Maximum length: 64 characters
- Pattern:
^([0-9a-zA-Z:.][ _-]?)+$
modelSource
Type:
IBedrock
The model source for this inference profile.
To create an application inference profile for one Region, specify a foundation model. Usage and costs for requests made to that Region with that model will be tracked.
To create an application inference profile for multiple Regions, specify a cross region (system-defined) inference profile. The inference profile will route requests to the Regions defined in the cross region (system-defined) inference profile that you choose. Usage and costs for requests made to the Regions in the inference profile will be tracked.
description?
Type:
string
(optional, default: No description is provided)
Description of the inference profile. Provides additional context about the purpose and usage of this inference profile.
- Maximum length: 200 characters when provided
- Pattern:
^([0-9a-zA-Z:.][ _-]?)+$
tags?
Type:
{ [string]: string }
(optional, default: No tags are applied)
A list of tags associated with the inference profile.
Tags help you organize and categorize your AWS resources.
Properties
Name | Type | Description |
---|---|---|
created | string | Time Stamp for Application Inference Profile creation. |
env | Resource | The environment this resource belongs to. |
inference | string | The ARN of the application inference profile. |
inference | string | The unique identifier of the application inference profile. |
inference | IBedrock | The underlying model/cross-region model used by the application inference profile. |
inference | string | The name of the application inference profile. |
invokable | string | The ARN used for invoking this inference profile. |
node | Node | The tree node. |
stack | Stack | The stack in which this resource is defined. |
status | string | The status of the application inference profile. |
type | Inference | The type of the inference profile. |
updated | string | Time Stamp for Application Inference Profile update. |
static PROPERTY_INJECTION_ID | string | Uniquely identifies this class. |
createdAt
Type:
string
Time Stamp for Application Inference Profile creation.
env
Type:
Resource
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
inferenceProfileArn
Type:
string
The ARN of the application inference profile.
inferenceProfileId
Type:
string
The unique identifier of the application inference profile.
inferenceProfileModel
Type:
IBedrock
The underlying model/cross-region model used by the application inference profile.
inferenceProfileName
Type:
string
The name of the application inference profile.
invokableArn
Type:
string
The ARN used for invoking this inference profile.
This equals to the inferenceProfileArn property, useful for implementing IBedrockInvokable interface.
node
Type:
Node
The tree node.
stack
Type:
Stack
The stack in which this resource is defined.
status
Type:
string
The status of the application inference profile.
ACTIVE means that the inference profile is ready to be used.
type
Type:
Inference
The type of the inference profile.
Always APPLICATION for application inference profiles.
updatedAt
Type:
string
Time Stamp for Application Inference Profile update.
static PROPERTY_INJECTION_ID
Type:
string
Uniquely identifies this class.
Methods
Name | Description |
---|---|
apply | Apply the given removal policy to this resource. |
grant | Gives the appropriate policies to invoke and use the application inference profile. |
grant | Grants appropriate permissions to use the application inference profile (AIP). |
to | Returns a string representation of this construct. |
static from | Import an Application Inference Profile given its attributes. |
static from | Import a low-level L1 Cfn Application Inference Profile. |
applyRemovalPolicy(policy)
public applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
Removal
Policy
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
).
grantInvoke(grantee)
public grantInvoke(grantee: IGrantable): Grant
Parameters
- grantee
IGrantable
โ - The IAM principal to grant permissions to.
Returns
Gives the appropriate policies to invoke and use the application inference profile.
This method ensures the appropriate permissions are given to use either the inference profile or the underlying foundation model/cross-region profile.
grantProfileUsage(grantee)
public grantProfileUsage(grantee: IGrantable): Grant
Parameters
- grantee
IGrantable
โ - The IAM principal to grant permissions to.
Returns
Grants appropriate permissions to use the application inference profile (AIP).
This method adds the necessary IAM permissions to allow the grantee to:
- Get inference profile details (bedrock:GetInferenceProfile)
- Invoke the model through the inference profile (bedrock:InvokeModel)
Note: This does not grant permissions to use the underlying model/cross-region profile in the AIP. For comprehensive permissions, use grantInvoke() instead.
toString()
public toString(): string
Returns
string
Returns a string representation of this construct.
static fromApplicationInferenceProfileAttributes(scope, id, attrs)
public static fromApplicationInferenceProfileAttributes(scope: Construct, id: string, attrs: ApplicationInferenceProfileAttributes): IInferenceProfile
Parameters
- scope
Construct
โ - The construct scope. - id
string
โ - Identifier of the construct. - attrs
Application
โ - Attributes of the existing application inference profile.Inference Profile Attributes
Returns
Import an Application Inference Profile given its attributes.
static fromCfnApplicationInferenceProfile(cfnApplicationInferenceProfile)
public static fromCfnApplicationInferenceProfile(cfnApplicationInferenceProfile: CfnApplicationInferenceProfile): IInferenceProfile
Parameters
- cfnApplicationInferenceProfile
Cfn
โ - The L1 CfnApplicationInferenceProfile to import.Application Inference Profile
Returns
Import a low-level L1 Cfn Application Inference Profile.