aws-lambda-bedrockinferenceprofile
| Reference Documentation: | https://docs.aws.amazon.com/solutions/latest/constructs/ |
| Language | Package |
|---|---|
|
|
|
|
|
|
|
|
|
Overview
This AWS Solutions Construct implements a Lambda function granted access
to a new Bedrock Inference Profile.
Inference
profiles
Here is a minimal deployable pattern definition:
Example
Pattern Construct Props
| Name | Type | Description |
|---|---|---|
|
existingLambdaObj? |
Optional - instance of an existing Lambda Function object, providing both this and
|
|
|
lambdaFunctionProps? |
Optional - user provided props to override the default props for the Lambda function. Providing both this and |
|
|
existingVpc? |
An optional, existing VPC into which this pattern should be deployed.
When deployed in a VPC, the Lambda function will use ENIs in the VPC to
access network resources and an Interface Endpoint will be created in
the VPC for Amazon Bedrock and Bedrock-Runtime. If an existing VPC is
provided, the |
|
|
vpcProps? |
Optional user provided properties to override the default properties
for the new VPC. |
|
|
deployVpc? |
|
Whether to create a new VPC based on |
|
bedrockModelId |
|
The foundation model to use with the
inference profile. Depending on whether the deployment is cross region
or single region, he construct will create the correct inference profile
name and and assign IAM permissions to the Lambda function allowing
access to the foundation model in all appropriate regions. For all of
this to occur, the model must be specified here and not in
|
|
inferenceProfileProps? |
This is where you set tags required for tracking inference calls. Do not populate the copyFrom attribute - the construct will populate this based upon the model sent in bedrockModelId (this allows the construct to correctly create all the other dependencies like the required IAM policies). If the copyFrom attribute is supplied here the construct will throw an error. The construct will also set a unique, stack specific inferenceProfileName - you may override that name here, but it is not recommended. |
|
|
deployCrossRegionProfile |
boolean |
Whether to deploy a cross-region
inference profile that will automatically distribute Invoke calls across
multiple regions. Note that at the time of this writing, cross-region
profiles are only available in
US,
EMEA and APAC. Single region profiles are available in every region
supporting Bedrock models. Defaults to |
|
foundationModelEnvironmentVariableName? |
string |
Optional Name for the Lambda function environment variable set to the Model name. Defaults to BEDROCK_MODEL |
|
inferenceProfileEnvironmentVariableName? |
string |
Optional Name for the Lambda function environment variable set to the inference profile arn. Defaults to BEDROCK_PROFILE |
Pattern Properties
| Name | Type | Description |
|---|---|---|
|
lambdaFunction |
Returns an instance of the Lambda function created by the pattern. |
|
|
inferenceProfile |
The inference profile created by the construct. |
|
|
vpc? |
Returns an interface on the VPC used by the pattern (if any). This may be a VPC created by the pattern or the VPC supplied to the pattern constructor. |
Default settings
Out of the box implementation of the Construct without any override will set the following defaults:
AWS Lambda Function
-
Configure limited privilege access IAM role for Lambda function, granting Invoke privileges for:
-
The new inference profile
-
The appropriate foundation model in all regions in the geographic area. For single region inference profiles, access is only granted to model in the current region.
-
-
Enable reusing connections with Keep-Alive for NodeJs Lambda function
-
Enable X-Ray Tracing
-
Set Environment Variables
-
(default) BEDROCK_PROFILE
-
(default) BEDROCK_MODEL
-
Amazon Bedrock Inference Profile
-
Cross-region inference profile for provided model by default
-
Geographic area prefix in arn defaults to value appropriate for deployment region (e.g. would us "us" for us-east-1 deployment)
Architecture
Github
Go to the Github repo