CfnApplicationInferenceProfileProps Struct
Properties for defining a CfnApplicationInferenceProfile.
| Source | |
|---|---|
| Type last changed |
Example
ts
// Create or reference an existing L1 CfnApplicationInferenceProfile
const cfnProfile = new aws_bedrock_cfn.CfnApplicationInferenceProfile(this, 'CfnProfile', {
inferenceProfileName: 'my-cfn-profile',
modelSource: {
copyFrom: bedrock.BedrockFoundationModel.ANTHROPIC_CLAUDE_3_5_SONNET_V1_0.invokableArn,
},
description: 'Profile created via L1 construct',
});
// Import the L1 construct as an L2 ApplicationInferenceProfile
const importedFromCfn = bedrock.ApplicationInferenceProfile.fromCfnApplicationInferenceProfile(cfnProfile);
// Grant permissions to use the imported profile
const lambdaFunction = new lambda.Function(this, 'MyFunction', {
runtime: lambda.Runtime.PYTHON_3_11,
handler: 'index.handler',
code: lambda.Code.fromInline('def handler(event, context): return "Hello"'),
});
importedFromCfn.grantProfileUsage(lambdaFunction);
python
# Create or reference an existing L1 CfnApplicationInferenceProfile
cfn_profile = aws_bedrock_cfn.CfnApplicationInferenceProfile(self, "CfnProfile",
inference_profile_name="my-cfn-profile",
model_source=aws_bedrock_cfn.CfnApplicationInferenceProfile.InferenceProfileModelSourceProperty(
copy_from=bedrock.BedrockFoundationModel.ANTHROPIC_CLAUDE_3_5_SONNET_V1_0.invokable_arn
),
description="Profile created via L1 construct"
)
# Import the L1 construct as an L2 ApplicationInferenceProfile
imported_from_cfn = bedrock.ApplicationInferenceProfile.from_cfn_application_inference_profile(cfn_profile)
# Grant permissions to use the imported profile
lambda_function = lambda_.Function(self, "MyFunction",
runtime=lambda_.Runtime.PYTHON_3_11,
handler="index.handler",
code=lambda_.Code.from_inline("def handler(event, context): return \"Hello\"")
)
imported_from_cfn.grant_profile_usage(lambda_function)
java
// Create or reference an existing L1 CfnApplicationInferenceProfile
CfnApplicationInferenceProfile cfnProfile = CfnApplicationInferenceProfile.Builder.create(this, "CfnProfile")
.inferenceProfileName("my-cfn-profile")
.modelSource(InferenceProfileModelSourceProperty.builder()
.copyFrom(BedrockFoundationModel.ANTHROPIC_CLAUDE_3_5_SONNET_V1_0.getInvokableArn())
.build())
.description("Profile created via L1 construct")
.build();
// Import the L1 construct as an L2 ApplicationInferenceProfile
IInferenceProfile importedFromCfn = ApplicationInferenceProfile.fromCfnApplicationInferenceProfile(cfnProfile);
// Grant permissions to use the imported profile
Function lambdaFunction = Function.Builder.create(this, "MyFunction")
.runtime(Runtime.PYTHON_3_11)
.handler("index.handler")
.code(Code.fromInline("def handler(event, context): return \"Hello\""))
.build();
importedFromCfn.grantProfileUsage(lambdaFunction);
csharp
// Install: dotnet add package Amazon.CDK.Lib
// Create or reference an existing L1 CfnApplicationInferenceProfile
var cfnProfile = new CfnApplicationInferenceProfile(this, "CfnProfile", new CfnApplicationInferenceProfileProps {
InferenceProfileName = "my-cfn-profile",
ModelSource = new InferenceProfileModelSourceProperty {
CopyFrom = BedrockFoundationModel.ANTHROPIC_CLAUDE_3_5_SONNET_V1_0.InvokableArn
},
Description = "Profile created via L1 construct"
});
// Import the L1 construct as an L2 ApplicationInferenceProfile
var importedFromCfn = ApplicationInferenceProfile.FromCfnApplicationInferenceProfile(cfnProfile);
// Grant permissions to use the imported profile
var lambdaFunction = new Function(this, "MyFunction", new FunctionProps {
Runtime = Runtime.PYTHON_3_11,
Handler = "index.handler",
Code = Code.FromInline("def handler(event, context): return \"Hello\"")
});
importedFromCfn.GrantProfileUsage(lambdaFunction);
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// Create or reference an existing L1 CfnApplicationInferenceProfile
cfnProfile := awscdk.Aws_bedrock.NewCfnApplicationInferenceProfile(this, jsii.String("CfnProfile"), &CfnApplicationInferenceProfileProps{
InferenceProfileName: jsii.String("my-cfn-profile"),
ModelSource: &InferenceProfileModelSourceProperty{
CopyFrom: bedrock.BedrockFoundationModel_ANTHROPIC_CLAUDE_3_5_SONNET_V1_0().InvokableArn,
},
Description: jsii.String("Profile created via L1 construct"),
})
// Import the L1 construct as an L2 ApplicationInferenceProfile
importedFromCfn := bedrock.ApplicationInferenceProfile_FromCfnApplicationInferenceProfile(cfnProfile)
// Grant permissions to use the imported profile
lambdaFunction := lambda.NewFunction(this, jsii.String("MyFunction"), &FunctionProps{
Runtime: lambda.Runtime_PYTHON_3_11(),
Handler: jsii.String("index.handler"),
Code: lambda.Code_FromInline(jsii.String("def handler(event, context): return \"Hello\"")),
})
importedFromCfn.GrantProfileUsage(lambdaFunction)
Properties
descriptionoptionalstringdescriptionoptionalstrdescriptionoptionalStringDescriptionoptionalstringDescriptionoptional*string #The description of the inference profile.
inferenceProfileNamestringinference_profile_namestrinferenceProfileNameStringInferenceProfileNamestringInferenceProfileName*string required #The name of the inference profile.
modelSourceoptionalIResolvable | CfnApplicationInferenceProfile.model_sourceoptionaltyping.Union[IResolvable, InferenceProfileModelSourceProperty]modelSourceoptionalIResolvableModelSourceoptionalIResolvableModelSourceoptionalinterface{} #Contains configurations for the inference profile to copy as the resource.