ApplicationInferenceProfile

class aws_cdk.aws_bedrock_alpha.ApplicationInferenceProfile(scope, id, *, application_inference_profile_name, model_source, description=None, tags=None)

Bases: InferenceProfileBase

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

See:

https://docs.aws.amazon.com/bedrock/latest/userguide/inference-profiles-create.html

Stability:

experimental

CloudformationResource:

AWS::Bedrock::ApplicationInferenceProfile

ExampleMetadata:

fixture=default infused

Example:

# Create a cross-region inference profile
cross_region_profile = bedrock.CrossRegionInferenceProfile.from_config(
    geo_region=bedrock.CrossRegionInferenceProfileRegion.US,
    model=bedrock.BedrockFoundationModel.ANTHROPIC_CLAUDE_3_5_SONNET_V2_0
)

# Create an application inference profile across regions
app_profile = bedrock.ApplicationInferenceProfile(self, "MyMultiRegionProfile",
    application_inference_profile_name="claude-35-sonnet-v2-multi-region",
    model_source=cross_region_profile,
    description="Multi-region application profile for cost tracking"
)
Parameters:
  • scope (Construct)

  • id (str)

  • application_inference_profile_name (str) – (experimental) 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:.][ _-]?)+$

  • model_source (IBedrockInvokable) – (experimental) 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 (Optional[str]) – (experimental) 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:.][ _-]?)+$ Default: - No description is provided

  • tags (Optional[Mapping[str, str]]) – (experimental) A list of tags associated with the inference profile. Tags help you organize and categorize your AWS resources. Default: - No tags are applied

Stability:

experimental

Methods

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

Parameters:

policy (RemovalPolicy)

Return type:

None

grant_invoke(grantee)

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

Parameters:

grantee (IGrantable) –

  • The IAM principal to grant permissions to.

Return type:

Grant

Returns:

An IAM Grant object representing the granted permissions

Stability:

experimental

grant_profile_usage(grantee)

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

Parameters:

grantee (IGrantable) –

  • The IAM principal to grant permissions to.

Return type:

Grant

Returns:

An IAM Grant object representing the granted permissions

Stability:

experimental

to_string()

Returns a string representation of this construct.

Return type:

str

Attributes

PROPERTY_INJECTION_ID = '@aws-cdk.aws-bedrock-alpha.ApplicationInferenceProfile'
created_at

(experimental) Time Stamp for Application Inference Profile creation.

Stability:

experimental

Attribute:

true

env

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.

inference_profile_arn

(experimental) The ARN of the application inference profile.

Stability:

experimental

Attribute:

true

inference_profile_id

(experimental) The unique identifier of the application inference profile.

Stability:

experimental

Attribute:

true

inference_profile_model

(experimental) The underlying model/cross-region model used by the application inference profile.

Stability:

experimental

inference_profile_name

(experimental) The name of the application inference profile.

Stability:

experimental

invokable_arn

(experimental) The ARN used for invoking this inference profile.

This equals to the inferenceProfileArn property, useful for implementing IBedrockInvokable interface.

Stability:

experimental

node

The tree node.

stack

The stack in which this resource is defined.

status

(experimental) The status of the application inference profile.

ACTIVE means that the inference profile is ready to be used.

Stability:

experimental

Attribute:

true

type

(experimental) The type of the inference profile.

Always APPLICATION for application inference profiles.

Stability:

experimental

updated_at

(experimental) Time Stamp for Application Inference Profile update.

Stability:

experimental

Attribute:

true

Static Methods

classmethod from_application_inference_profile_attributes(scope, id, *, inference_profile_arn, inference_profile_identifier)

(experimental) Import an Application Inference Profile given its attributes.

Parameters:
  • scope (Construct) –

    • The construct scope.

  • id (str) –

    • Identifier of the construct.

  • inference_profile_arn (str) – (experimental) The ARN of the application inference profile.

  • inference_profile_identifier (str) – (experimental) The ID or Amazon Resource Name (ARN) of the inference profile. This can be either the profile ID or the full ARN.

Return type:

IInferenceProfile

Returns:

An IInferenceProfile reference to the existing application inference profile

Stability:

experimental

classmethod from_cfn_application_inference_profile(cfn_application_inference_profile)

(experimental) Import a low-level L1 Cfn Application Inference Profile.

Parameters:

cfn_application_inference_profile (CfnApplicationInferenceProfile) –

  • The L1 CfnApplicationInferenceProfile to import.

Return type:

IInferenceProfile

Returns:

An IInferenceProfile reference to the imported application inference profile

Stability:

experimental

classmethod is_construct(x)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

Parameters:

x (Any) – Any object.

Return type:

bool

Returns:

true if x is an object created from a class which extends Construct.

classmethod is_owned_resource(construct)

Returns true if the construct was created by CDK, and false otherwise.

Parameters:

construct (IConstruct)

Return type:

bool

classmethod is_resource(construct)

Check whether the given construct is a Resource.

Parameters:

construct (IConstruct)

Return type:

bool