konokenj.cdk-api-mcp-server 0.31.0__py3-none-any.whl → 0.57.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of konokenj.cdk-api-mcp-server might be problematic. Click here for more details.
- cdk_api_mcp_server/__about__.py +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/aws-amplify-alpha/README.md +12 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/aws-bedrock-agentcore-alpha/README.md +1979 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/aws-bedrock-alpha/README.md +946 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/aws-eks-v2-alpha/README.md +160 -75
- cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/aws-elasticache-alpha/README.md +421 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/aws-glue-alpha/README.md +39 -9
- cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/aws-imagebuilder-alpha/README.md +656 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/aws-iot-alpha/README.md +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/aws-lambda-go-alpha/README.md +102 -4
- cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/aws-lambda-python-alpha/README.md +6 -6
- cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/aws-msk-alpha/README.md +38 -8
- cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/aws-s3tables-alpha/README.md +82 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/aws-sagemaker-alpha/README.md +32 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/@aws-cdk/mixins-preview/README.md +182 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/README.md/README.md +367 -17
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigateway/README.md +34 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigateway/integ.api-with-authorizer-and-proxy.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigateway/integ.lambda-api.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigateway/integ.lambda-permission-consolidation.ts +55 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigateway/integ.spec-restapi.ts +1 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2/README.md +224 -60
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2/integ.api-dualstack.ts +3 -4
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2/integ.api.ts +5 -3
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2/integ.stage.ts +10 -7
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2/integ.usage-plan.ts +80 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2-authorizers/integ.iam.ts +34 -38
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2-authorizers/integ.lambda.ts +2 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2-authorizers/integ.user-pool.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2-integrations/README.md +35 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2-integrations/integ.add-subroute-integration.ts +7 -4
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2-integrations/integ.http-proxy.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2-integrations/integ.lambda-connect-disconnect-trigger.ts +2 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2-integrations/integ.lambda-permission-consolidation.ts +45 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2-integrations/integ.lambda-proxy.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2-integrations/integ.lambda.ts +4 -4
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-apigatewayv2-integrations/integ.sqs.ts +58 -71
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-appsync/integ.graphql-lambda-permission.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-appsync/integ.js-resolver.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-autoscaling/README.md +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-autoscaling/integ.asg-lt.ts +7 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-batch/README.md +49 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-batch/integ.ecs-exec-batch-job.ts +148 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-batch/integ.managed-compute-environment-default-instance-class.ts +20 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-certificatemanager/README.md +11 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cloudformation/integ.core-custom-resources-node-18.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cloudformation/integ.core-custom-resources-service-timeout.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cloudfront/README.md +292 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cloudfront-origins/README.md +83 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cloudfront-origins/integ.function-url-origin-ip-address-type.ts +84 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cloudfront-origins/integ.http-origin.ts +5 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cloudfront-origins/integ.origin-response-completion-timeout.ts +50 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cloudtrail/integ.cloudtrail-data-events-only.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cloudwatch/README.md +104 -12
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cloudwatch/integ.alarm-and-dashboard.ts +12 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cloudwatch/integ.anomaly-detection-alarm.ts +44 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cloudwatch/integ.dashboard-with-graphwidget-with-labels-visible.ts +92 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cloudwatch/integ.dashboard-with-metric-id-and-visible.ts +70 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cloudwatch/integ.search-expression.ts +51 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-codebuild/README.md +143 -3
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-codebuild/integ.project-docker-server.ts +44 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-codebuild/integ.project-fleet-attribute-based-compute.ts +59 -7
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-codebuild/integ.project-fleet-custom-instance-type.ts +130 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-codebuild/integ.project-fleet-overflow-behavior.ts +61 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-codebuild/integ.project-s3-cache.ts +71 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-codebuild/integ.project-windows-image.ts +1 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-codepipeline-actions/integ.pipeline-elastic-beanstalk-deploy.ts +26 -17
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cognito/README.md +13 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-cognito/integ.user-pool-client-explicit-props.ts +1 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-docdb/README.md +24 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-docdb/integ.cluster-serverless.ts +34 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-dynamodb/README.md +225 -15
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-dynamodb/TABLE_V1_API.md +45 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-dynamodb/integ.dynamodb-v2.cci.ts +49 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-dynamodb/integ.dynamodb.add-to-resource-policy.ts +97 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-dynamodb/integ.dynamodb.cci.ts +27 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-dynamodb/integ.dynamodb.compound.ts +32 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-dynamodb/integ.dynamodb.contirubtor-insights-for-gsi.ts +6 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-dynamodb/integ.dynamodb.policy.ts +21 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-dynamodb/integ.table-v2-global.ts +9 -3
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-dynamodb/integ.table-v2-mrsc.ts +31 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-dynamodb/integ.table-v2.compound.ts +43 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ec2/README.md +28 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ec2/integ.client-vpn-endpoint-disconnect-on-session-timeout.ts +65 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ec2/integ.vpc-endpoint.lit.ts +6 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ec2/integ.vpc-flow-logs.ts +4 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecr/README.md +41 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecr/integ.tag-mutability-exclusion.ts +30 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecr-assets/README.md +4 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecr-assets/integ.assets-docker.ts +6 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/README.md +189 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/integ.availability-zone-rebalancing.ts +14 -4
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/integ.blue-green-deployment-strategy.ts +147 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/integ.cluster-windows-server-ami.ts +5 -6
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/integ.ebs-volume-initialization-rate.ts +80 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/integ.enable-execute-command.ts +35 -29
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/integ.exec-command.ts +16 -22
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/integ.lb-awsvpc-nw.ts +26 -16
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/integ.managedinstances-capacity-provider.ts +114 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/integ.managedinstances-no-default-capacity-provider.ts +107 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/integ.placement-strategies.ts +32 -8
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs/integ.pseudo-terminal.ts +18 -8
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs-patterns/README.md +2 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs-patterns/integ.alb-fargate-service-public-private-switch.ts +45 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-ecs-patterns/integ.alb-fargate-service-smart-defaults.ts +143 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-eks/README.md +103 -83
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-eks/integ.eks-al2023-nodegroup.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-eks/integ.eks-cluster-removal-policy.ts +31 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-eks/integ.fargate-cluster.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-elasticloadbalancingv2/README.md +55 -4
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-elasticloadbalancingv2/integ.alb-lambda-multi-value-headers.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-elasticloadbalancingv2/integ.alb-target-group-attributes.ts +45 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-elasticloadbalancingv2/integ.alb.oidc.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-elasticloadbalancingv2/integ.nlb-target-group-attributes.ts +45 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-elasticloadbalancingv2/integ.nlb.security-group.ts +70 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-elasticloadbalancingv2-actions/integ.cognito.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-events/README.md +41 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-events/integ.api-destination.ts +42 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-events/integ.archive-customer-managed-key.ts +23 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-events/integ.eventbus.ts +13 -3
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-events-targets/README.md +93 -4
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-events-targets/integ.firehose-delivery-stream.ts +51 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-iam/integ.custom-permissions-boundary-aspect.ts +50 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-iam/integ.managed-policy.ts +9 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-iam/integ.policy.ts +9 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-kinesis/README.md +42 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-kinesis/integ.stream-shard-level-monitoring.ts +47 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-kinesisfirehose/README.md +159 -3
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-kinesisfirehose/integ.cloudwatch-logs-processors.ts +45 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-kinesisfirehose/integ.record-format-conversion-schema.ts +154 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-kinesisfirehose/integ.record-format-conversion.ts +178 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-kinesisfirehose/integ.s3-bucket.lit.ts +1 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda/README.md +41 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda/integ.binary-payload.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda/integ.lambda-policy-with-token-resolution.ts +46 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda/integ.logging-config.ts +8 -8
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda/integ.multi-tenancy.ts +24 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda/integ.params-and-secrets.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda/integ.runtime-management.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda/integ.runtime.fromasset.ts +19 -4
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda/integ.runtime.inlinecode.ts +11 -4
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda-nodejs/README.md +3 -3
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda-nodejs/integ.dependencies-bun-lock.ts +50 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda-nodejs/integ.dependencies-pnpm.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda-nodejs/integ.function-exclude-smithy-models.ts +2 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-lambda-nodejs/integ.nodejs.build.images.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-logs/README.md +69 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-logs/integ.loggroup-transformer.ts +37 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-logs/integ.metricfilter-apply-on-transformed-logs.ts +29 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-logs/integ.save-logs-insights-query-definition.ts +7 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-logs/integ.subscriptionfilter.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-logs/integ.transformer.ts +27 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-opensearchservice/integ.opensearch.ebs.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-opensearchservice/integ.opensearch.min.ts +1 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-rds/README.md +72 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-rds/integ.cluster-cloudwatch-logs-exports.ts +56 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-rds/integ.cluster-data-api-to-imported-cluster.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-rds/integ.cluster-data-api.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-rds/integ.cluster-lookup.ts +100 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-rds/integ.cluster.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-rds/integ.instance-database-insights.ts +43 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-rds/integ.instance-lookup.ts +77 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-rds/integ.proxy-endpoint.ts +36 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-route53/README.md +68 -31
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-route53/integ.delete-existing-record-set.ts +0 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-route53/integ.private-hosted-zone-from-attributes.ts +41 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-route53/integ.route53.ts +51 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-route53/integ.zone-delegation-iam-stack.ts +66 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-route53-targets/integ.cloudfront-alias-target.ts +16 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-route53-targets/integ.elastic-beanstalk-hostedzoneid.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3/integ.bucket.notifications-scoped-permissions.ts +71 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-assets/integ.assets.bundling.docker-opts.ts +4 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/README.md +83 -4
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-big-response.ts +17 -6
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-cloudfront.ts +20 -18
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-cross-nested-stack-source.ts +64 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-cross-stack-source.ts +53 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-cross-stack-ssm-source.ts +97 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-data.ts +99 -59
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-deployed-bucket.ts +10 -4
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-large-file.ts +23 -12
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-loggroup.ts +7 -2
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-security-groups-efs.ts +77 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-security-groups-empty.ts +69 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-security-groups-multiple.ts +89 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-security-groups-single.ts +77 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-signcontent.ts +11 -7
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-substitution-with-destination-key.ts +15 -8
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-substitution-with-role.ts +29 -14
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-substitution.ts +16 -8
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-vpc-basic.ts +65 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-vpc-config.ts +66 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-vpc-custom-subnets.ts +66 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-vpc-efs.ts +66 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-vpc-security-groups.ts +72 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-vpc-subnet-selection.ts +70 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment.ts +47 -69
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-notifications/integ.bucket-notifications.ts +80 -42
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-secretsmanager/integ.secret.dynamic-reference-key.ts +38 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-signer/integ.signing-profile.ts +5 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-sns/README.md +2 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-sns-subscriptions/integ.sns-sqs-subscription-filter.ts +75 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-sns-subscriptions/integ.sns-sqs.ts +21 -40
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-stepfunctions/integ.distributed-map-parallel.ts +82 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-stepfunctions/integ.distributed-map-redrive.ts +130 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-stepfunctions/integ.map-with-catch.ts +1 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-stepfunctions/integ.sm-jsonpath-with-distributed-map-jsonata.ts +105 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-stepfunctions-tasks/README.md +75 -5
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-stepfunctions-tasks/integ.call-aws-service-cross-region-lambda.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-stepfunctions-tasks/integ.emr-create-cluster-with-ebs.ts +126 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-stepfunctions-tasks/integ.evaluate-expression-arm64.ts +27 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-stepfunctions-tasks/integ.evaluate-expression-default.ts +25 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-stepfunctions-tasks/integ.evaluate-expression-mixed-arch.ts +35 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-stepfunctions-tasks/integ.evaluate-expression-nodejs22.ts +27 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-stepfunctions-tasks/integ.evaluate-expression-x86.ts +27 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-stepfunctions-tasks/integ.invoke-json-path.ts +102 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-synthetics/README.md +84 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-synthetics/integ.canary-browser-type.ts +35 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-synthetics/integ.canary-resources-to-replicate-tags.ts +36 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-synthetics/integ.canary-retry.ts +32 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-synthetics/integ.canary-runtime-validation.ts +43 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-synthetics/integ.canary.ts +2 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/cloudformation-include/integ.novalue-nonstring.ts +25 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/core/README.md +2 -1870
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/custom-resources/README.md +59 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/custom-resources/integ.aws-custom-resource.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/custom-resources/integ.custom-resource-config-lambda-node-runtime.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/custom-resources/integ.external-id.ts +80 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/custom-resources/integ.invoke-function-payload.ts +1 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/cx-api/FEATURE_FLAGS.md +152 -10
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/cx-api/README.md +55 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/interfaces/README.md +33 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/pipelines/README.md +4 -0
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/pipelines/integ.newpipeline-reduce-stagerole-scope.ts +4 -1
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/pipelines/integ.pipeline-with-customsynthesizer.ts +105 -0
- {konokenj_cdk_api_mcp_server-0.31.0.dist-info → konokenj_cdk_api_mcp_server-0.57.0.dist-info}/METADATA +2 -2
- {konokenj_cdk_api_mcp_server-0.31.0.dist-info → konokenj_cdk_api_mcp_server-0.57.0.dist-info}/RECORD +240 -151
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-events-targets/integ.kinesis-firehose-stream.ts +0 -33
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-logs/integ.expose-metric-with-dimensions.ts +0 -47
- cdk_api_mcp_server/resources/aws-cdk/constructs/aws-cdk-lib/aws-s3-deployment/integ.bucket-deployment-signcontent.d.ts +0 -1
- {konokenj_cdk_api_mcp_server-0.31.0.dist-info → konokenj_cdk_api_mcp_server-0.57.0.dist-info}/WHEEL +0 -0
- {konokenj_cdk_api_mcp_server-0.31.0.dist-info → konokenj_cdk_api_mcp_server-0.57.0.dist-info}/entry_points.txt +0 -0
- {konokenj_cdk_api_mcp_server-0.31.0.dist-info → konokenj_cdk_api_mcp_server-0.57.0.dist-info}/licenses/LICENSE.txt +0 -0
|
@@ -35,6 +35,34 @@ This construct library facilitates the deployment of Bedrock Agents, enabling yo
|
|
|
35
35
|
- [Agent Collaboration](#agent-collaboration)
|
|
36
36
|
- [Custom Orchestration](#custom-orchestration)
|
|
37
37
|
- [Agent Alias](#agent-alias)
|
|
38
|
+
- [Guardrails](#guardrails)
|
|
39
|
+
- [Guardrail Properties](#guardrail-properties)
|
|
40
|
+
- [Filter Types](#filter-types)
|
|
41
|
+
- [Content Filters](#content-filters)
|
|
42
|
+
- [Denied Topics](#denied-topics)
|
|
43
|
+
- [Word Filters](#word-filters)
|
|
44
|
+
- [PII Filters](#pii-filters)
|
|
45
|
+
- [Regex Filters](#regex-filters)
|
|
46
|
+
- [Contextual Grounding Filters](#contextual-grounding-filters)
|
|
47
|
+
- [Guardrail Methods](#guardrail-methods)
|
|
48
|
+
- [Guardrail Permissions](#guardrail-permissions)
|
|
49
|
+
- [Guardrail Metrics](#guardrail-metrics)
|
|
50
|
+
- [Importing Guardrails](#importing-guardrails)
|
|
51
|
+
- [Guardrail Versioning](#guardrail-versioning)
|
|
52
|
+
- [Prompts](#prompts)
|
|
53
|
+
- [Prompt Variants](#prompt-variants)
|
|
54
|
+
- [Basic Text Prompt](#basic-text-prompt)
|
|
55
|
+
- [Chat Prompt](#chat-prompt)
|
|
56
|
+
- [Agent Prompt](#agent-prompt)
|
|
57
|
+
- [Prompt Properties](#prompt-properties)
|
|
58
|
+
- [Prompt Version](#prompt-version)
|
|
59
|
+
- [Import Methods](#import-methods)
|
|
60
|
+
- [Inference Profiles](#inference-profiles)
|
|
61
|
+
- [Using Inference Profiles](#using-inference-profiles)
|
|
62
|
+
- [Types of Inference Profiles](#types-of-inference-profiles)
|
|
63
|
+
- [Prompt Routers](#prompt-routers)
|
|
64
|
+
- [Inference Profile Permissions](#inference-profile-permissions)
|
|
65
|
+
- [Inference Profiles Import Methods](#inference-profiles-import-methods)
|
|
38
66
|
|
|
39
67
|
## Agents
|
|
40
68
|
|
|
@@ -52,6 +80,29 @@ const agent = new bedrock.Agent(this, 'Agent', {
|
|
|
52
80
|
});
|
|
53
81
|
```
|
|
54
82
|
|
|
83
|
+
You can also create an agent with a guardrail:
|
|
84
|
+
|
|
85
|
+
```ts fixture=default
|
|
86
|
+
// Create a guardrail to filter inappropriate content
|
|
87
|
+
const guardrail = new bedrock.Guardrail(this, 'bedrockGuardrails', {
|
|
88
|
+
guardrailName: 'my-BedrockGuardrails',
|
|
89
|
+
description: 'Legal ethical guardrails.',
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
guardrail.addContentFilter({
|
|
93
|
+
type: bedrock.ContentFilterType.SEXUAL,
|
|
94
|
+
inputStrength: bedrock.ContentFilterStrength.HIGH,
|
|
95
|
+
outputStrength: bedrock.ContentFilterStrength.MEDIUM,
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
// Create an agent with the guardrail
|
|
99
|
+
const agentWithGuardrail = new bedrock.Agent(this, 'AgentWithGuardrail', {
|
|
100
|
+
foundationModel: bedrock.BedrockFoundationModel.ANTHROPIC_CLAUDE_HAIKU_V1_0,
|
|
101
|
+
instruction: 'You are a helpful and friendly agent that answers questions about literature.',
|
|
102
|
+
guardrail: guardrail,
|
|
103
|
+
});
|
|
104
|
+
```
|
|
105
|
+
|
|
55
106
|
### Agent Properties
|
|
56
107
|
|
|
57
108
|
The Bedrock Agent class supports the following properties.
|
|
@@ -67,6 +118,8 @@ The Bedrock Agent class supports the following properties.
|
|
|
67
118
|
| kmsKey | kms.IKey | No | The KMS key of the agent if custom encryption is configured. Defaults to AWS managed key |
|
|
68
119
|
| description | string | No | A description of the agent. Defaults to no description |
|
|
69
120
|
| actionGroups | AgentActionGroup[] | No | The Action Groups associated with the agent |
|
|
121
|
+
| guardrail | IGuardrail | No | The guardrail that will be associated with the agent. Defaults to no guardrail |
|
|
122
|
+
| memory | Memory | No | The type and configuration of the memory to maintain context across multiple sessions and recall past interactions. Defaults to no memory |
|
|
70
123
|
| promptOverrideConfiguration | PromptOverrideConfiguration | No | Overrides some prompt templates in different parts of an agent sequence configuration |
|
|
71
124
|
| userInputEnabled | boolean | No | Select whether the agent can prompt additional information from the user when it lacks enough information. Defaults to false |
|
|
72
125
|
| codeInterpreterEnabled | boolean | No | Select whether the agent can generate, run, and troubleshoot code when trying to complete a task. Defaults to false |
|
|
@@ -606,3 +659,896 @@ const agentAlias = new bedrock.AgentAlias(this, 'myAlias', {
|
|
|
606
659
|
description: `Production version of my agent. Created at ${agent.lastUpdated}` // ensure the version update
|
|
607
660
|
});
|
|
608
661
|
```
|
|
662
|
+
|
|
663
|
+
## Guardrails
|
|
664
|
+
|
|
665
|
+
Amazon Bedrock's Guardrails feature enables you to implement robust governance and control mechanisms for your generative AI applications, ensuring alignment with your specific use cases and responsible AI policies. Guardrails empowers you to create multiple tailored policy configurations, each designed to address the unique requirements and constraints of different use cases. These policy configurations can then be seamlessly applied across multiple foundation models (FMs) and Agents, ensuring a consistent user experience and standardizing safety, security, and privacy controls throughout your generative AI ecosystem.
|
|
666
|
+
|
|
667
|
+
With Guardrails, you can define and enforce granular, customizable policies to precisely govern the behavior of your generative AI applications. You can configure the following policies in a guardrail to avoid undesirable and harmful content and remove sensitive information for privacy protection.
|
|
668
|
+
|
|
669
|
+
Content filters – Adjust filter strengths to block input prompts or model responses containing harmful content.
|
|
670
|
+
Denied topics – Define a set of topics that are undesirable in the context of your application. These topics will be blocked if detected in user queries or model responses.
|
|
671
|
+
Word filters – Configure filters to block undesirable words, phrases, and profanity. Such words can include offensive terms, competitor names etc.
|
|
672
|
+
Sensitive information filters – Block or mask sensitive information such as personally identifiable information (PII) or custom regex in user inputs and model responses.
|
|
673
|
+
You can create a Guardrail with a minimum blockedInputMessaging, blockedOutputsMessaging and default content filter policy.
|
|
674
|
+
|
|
675
|
+
### Basic Guardrail Creation
|
|
676
|
+
|
|
677
|
+
#### TypeScript
|
|
678
|
+
|
|
679
|
+
```ts fixture=default
|
|
680
|
+
const guardrail = new bedrock.Guardrail(this, 'bedrockGuardrails', {
|
|
681
|
+
guardrailName: 'my-BedrockGuardrails',
|
|
682
|
+
description: 'Legal ethical guardrails.',
|
|
683
|
+
});
|
|
684
|
+
|
|
685
|
+
// add at least one policy for the guardrail
|
|
686
|
+
```
|
|
687
|
+
|
|
688
|
+
### Guardrail Properties
|
|
689
|
+
|
|
690
|
+
| Property | Type | Required | Description |
|
|
691
|
+
|----------|------|----------|-------------|
|
|
692
|
+
| guardrailName | string | Yes | The name of the guardrail |
|
|
693
|
+
| description | string | No | The description of the guardrail |
|
|
694
|
+
| blockedInputMessaging | string | No | The message to return when the guardrail blocks a prompt. Default: "Sorry, your query violates our usage policy." |
|
|
695
|
+
| blockedOutputsMessaging | string | No | The message to return when the guardrail blocks a model response. Default: "Sorry, I am unable to answer your question because of our usage policy." |
|
|
696
|
+
| kmsKey | IKey | No | A custom KMS key to use for encrypting data. Default: Your data is encrypted by default with a key that AWS owns and manages for you. |
|
|
697
|
+
| crossRegionConfig | GuardrailCrossRegionConfigProperty | No | The cross-region configuration for the guardrail. This enables cross-region inference for enhanced language support and filtering capabilities. Default: No cross-region configuration |
|
|
698
|
+
| contentFilters | ContentFilter[] | No | The content filters to apply to the guardrail |
|
|
699
|
+
| contentFiltersTierConfig | TierConfig | No | The tier configuration to apply to content filters. Default: TierConfig.CLASSIC |
|
|
700
|
+
| deniedTopics | Topic[] | No | Up to 30 denied topics to block user inputs or model responses associated with the topic |
|
|
701
|
+
| topicsTierConfig | TierConfig | No | The tier configuration to apply to topic filters. Default: TierConfig.CLASSIC |
|
|
702
|
+
| wordFilters | string[] | No | The word filters to apply to the guardrail |
|
|
703
|
+
| managedWordListFilters | ManagedWordFilterType[] | No | The managed word filters to apply to the guardrail |
|
|
704
|
+
| piiFilters | PIIFilter[] | No | The PII filters to apply to the guardrail |
|
|
705
|
+
| regexFilters | RegexFilter[] | No | The regular expression (regex) filters to apply to the guardrail |
|
|
706
|
+
| contextualGroundingFilters | ContextualGroundingFilter[] | No | The contextual grounding filters to apply to the guardrail |
|
|
707
|
+
|
|
708
|
+
### Filter Types
|
|
709
|
+
|
|
710
|
+
#### Content Filters
|
|
711
|
+
|
|
712
|
+
Content filters allow you to block input prompts or model responses containing harmful content. You can adjust the filter strength and configure separate actions for input and output.
|
|
713
|
+
|
|
714
|
+
##### Content Filter Configuration
|
|
715
|
+
|
|
716
|
+
```ts fixture=default
|
|
717
|
+
const guardrail = new bedrock.Guardrail(this, 'bedrockGuardrails', {
|
|
718
|
+
guardrailName: 'my-BedrockGuardrails',
|
|
719
|
+
// Configure tier for content filters (optional)
|
|
720
|
+
contentFiltersTierConfig: bedrock.TierConfig.STANDARD,
|
|
721
|
+
});
|
|
722
|
+
|
|
723
|
+
guardrail.addContentFilter({
|
|
724
|
+
type: bedrock.ContentFilterType.SEXUAL,
|
|
725
|
+
inputStrength: bedrock.ContentFilterStrength.HIGH,
|
|
726
|
+
outputStrength: bedrock.ContentFilterStrength.MEDIUM,
|
|
727
|
+
// props below are optional
|
|
728
|
+
inputAction: bedrock.GuardrailAction.BLOCK,
|
|
729
|
+
inputEnabled: true,
|
|
730
|
+
outputAction: bedrock.GuardrailAction.NONE,
|
|
731
|
+
outputEnabled: true,
|
|
732
|
+
inputModalities: [bedrock.ModalityType.TEXT, bedrock.ModalityType.IMAGE],
|
|
733
|
+
outputModalities: [bedrock.ModalityType.TEXT],
|
|
734
|
+
});
|
|
735
|
+
```
|
|
736
|
+
|
|
737
|
+
Available content filter types:
|
|
738
|
+
|
|
739
|
+
- `SEXUAL`: Describes input prompts and model responses that indicates sexual interest, activity, or arousal
|
|
740
|
+
- `VIOLENCE`: Describes input prompts and model responses that includes glorification of or threats to inflict physical pain
|
|
741
|
+
- `HATE`: Describes input prompts and model responses that discriminate, criticize, insult, denounce, or dehumanize a person or group
|
|
742
|
+
- `INSULTS`: Describes input prompts and model responses that includes demeaning, humiliating, mocking, insulting, or belittling language
|
|
743
|
+
- `MISCONDUCT`: Describes input prompts and model responses that seeks or provides information about engaging in misconduct activity
|
|
744
|
+
- `PROMPT_ATTACK`: Enable to detect and block user inputs attempting to override system instructions
|
|
745
|
+
|
|
746
|
+
Available content filter strengths:
|
|
747
|
+
|
|
748
|
+
- `NONE`: No filtering
|
|
749
|
+
- `LOW`: Light filtering
|
|
750
|
+
- `MEDIUM`: Moderate filtering
|
|
751
|
+
- `HIGH`: Strict filtering
|
|
752
|
+
|
|
753
|
+
Available guardrail actions:
|
|
754
|
+
|
|
755
|
+
- `BLOCK`: Blocks the content from being processed
|
|
756
|
+
- `ANONYMIZE`: Masks the content with an identifier tag
|
|
757
|
+
- `NONE`: Takes no action
|
|
758
|
+
|
|
759
|
+
> Warning: the ANONYMIZE action is not available in all configurations. Please refer to the documentation of each filter to see which ones
|
|
760
|
+
> support
|
|
761
|
+
|
|
762
|
+
Available modality types:
|
|
763
|
+
|
|
764
|
+
- `TEXT`: Text modality for content filters
|
|
765
|
+
- `IMAGE`: Image modality for content filters
|
|
766
|
+
|
|
767
|
+
#### Tier Configuration
|
|
768
|
+
|
|
769
|
+
Guardrails support tier configurations that determine the level of language support and robustness for content and topic filters. You can configure separate tier settings for content filters and topic filters.
|
|
770
|
+
|
|
771
|
+
##### Tier Configuration Options
|
|
772
|
+
|
|
773
|
+
```ts fixture=default
|
|
774
|
+
const guardrail = new bedrock.Guardrail(this, 'bedrockGuardrails', {
|
|
775
|
+
guardrailName: 'my-BedrockGuardrails',
|
|
776
|
+
// Configure tier for content filters
|
|
777
|
+
contentFiltersTierConfig: bedrock.TierConfig.STANDARD,
|
|
778
|
+
// Configure tier for topic filters
|
|
779
|
+
topicsTierConfig: bedrock.TierConfig.CLASSIC,
|
|
780
|
+
});
|
|
781
|
+
```
|
|
782
|
+
|
|
783
|
+
Available tier configurations:
|
|
784
|
+
|
|
785
|
+
- `CLASSIC`: Provides established guardrails functionality supporting English, French, and Spanish languages
|
|
786
|
+
- `STANDARD`: Provides a more robust solution than the CLASSIC tier and has more comprehensive language support. This tier requires that your guardrail use cross-Region inference
|
|
787
|
+
|
|
788
|
+
> Note: The STANDARD tier provides enhanced language support and more comprehensive filtering capabilities, but requires cross-Region inference to be enabled for your guardrail.
|
|
789
|
+
|
|
790
|
+
#### Cross-Region Configuration
|
|
791
|
+
|
|
792
|
+
You can configure a system-defined guardrail profile to use with your guardrail. Guardrail profiles define the destination AWS Regions where guardrail inference requests can be automatically routed. Using guardrail profiles helps maintain guardrail performance and reliability when demand increases.
|
|
793
|
+
|
|
794
|
+
##### Cross-Region Configuration Properties
|
|
795
|
+
|
|
796
|
+
| Property | Type | Required | Description |
|
|
797
|
+
|----------|------|----------|-------------|
|
|
798
|
+
| guardrailProfileArn | string | Yes | The ARN of the system-defined guardrail profile that defines the destination AWS Regions where guardrail inference requests can be automatically routed |
|
|
799
|
+
|
|
800
|
+
##### Cross-Region Configuration Example
|
|
801
|
+
|
|
802
|
+
```ts fixture=default
|
|
803
|
+
const guardrail = new bedrock.Guardrail(this, 'bedrockGuardrails', {
|
|
804
|
+
guardrailName: 'my-BedrockGuardrails',
|
|
805
|
+
description: 'Guardrail with cross-region configuration for enhanced language support',
|
|
806
|
+
crossRegionConfig: {
|
|
807
|
+
guardrailProfileArn: 'arn:aws:bedrock:us-east-1:123456789012:guardrail-profile/my-profile',
|
|
808
|
+
},
|
|
809
|
+
// Use STANDARD tier for enhanced capabilities
|
|
810
|
+
contentFiltersTierConfig: bedrock.TierConfig.STANDARD,
|
|
811
|
+
topicsTierConfig: bedrock.TierConfig.STANDARD,
|
|
812
|
+
});
|
|
813
|
+
```
|
|
814
|
+
|
|
815
|
+
> Note: Cross-region configuration is required when using the STANDARD tier for content and topic filters. It helps maintain guardrail performance and reliability when demand increases by automatically routing inference requests to appropriate regions.
|
|
816
|
+
|
|
817
|
+
You will need to provide the necessary permissions for cross region: https://docs.aws.amazon.com/bedrock/latest/userguide/guardrail-profiles-permissions.html .
|
|
818
|
+
|
|
819
|
+
#### Denied Topics
|
|
820
|
+
|
|
821
|
+
Denied topics allow you to define a set of topics that are undesirable in the context of your application. These topics will be blocked if detected in user queries or model responses. You can configure separate actions for input and output.
|
|
822
|
+
|
|
823
|
+
##### Denied Topic Configuration
|
|
824
|
+
|
|
825
|
+
```ts fixture=default
|
|
826
|
+
const guardrail = new bedrock.Guardrail(this, 'bedrockGuardrails', {
|
|
827
|
+
guardrailName: 'my-BedrockGuardrails',
|
|
828
|
+
// Configure tier for topic filters (optional)
|
|
829
|
+
topicsTierConfig: bedrock.TierConfig.STANDARD,
|
|
830
|
+
});
|
|
831
|
+
|
|
832
|
+
// Use a predefined topic
|
|
833
|
+
guardrail.addDeniedTopicFilter(bedrock.Topic.FINANCIAL_ADVICE);
|
|
834
|
+
|
|
835
|
+
// Create a custom topic with input/output actions
|
|
836
|
+
guardrail.addDeniedTopicFilter(
|
|
837
|
+
bedrock.Topic.custom({
|
|
838
|
+
name: 'Legal_Advice',
|
|
839
|
+
definition: 'Offering guidance or suggestions on legal matters, legal actions, interpretation of laws, or legal rights and responsibilities.',
|
|
840
|
+
examples: [
|
|
841
|
+
'Can I sue someone for this?',
|
|
842
|
+
'What are my legal rights in this situation?',
|
|
843
|
+
'Is this action against the law?',
|
|
844
|
+
'What should I do to file a legal complaint?',
|
|
845
|
+
'Can you explain this law to me?',
|
|
846
|
+
],
|
|
847
|
+
// props below are optional
|
|
848
|
+
inputAction: bedrock.GuardrailAction.BLOCK,
|
|
849
|
+
inputEnabled: true,
|
|
850
|
+
outputAction: bedrock.GuardrailAction.NONE,
|
|
851
|
+
outputEnabled: true,
|
|
852
|
+
})
|
|
853
|
+
);
|
|
854
|
+
```
|
|
855
|
+
|
|
856
|
+
#### Word Filters
|
|
857
|
+
|
|
858
|
+
Word filters allow you to block specific words, phrases, or profanity in user inputs and model responses. You can configure separate actions for input and output.
|
|
859
|
+
|
|
860
|
+
##### Word Filter Configuration
|
|
861
|
+
|
|
862
|
+
```ts fixture=default
|
|
863
|
+
const guardrail = new bedrock.Guardrail(this, 'bedrockGuardrails', {
|
|
864
|
+
guardrailName: 'my-BedrockGuardrails',
|
|
865
|
+
});
|
|
866
|
+
|
|
867
|
+
// Add managed word list with input/output actions
|
|
868
|
+
guardrail.addManagedWordListFilter({
|
|
869
|
+
type: bedrock.ManagedWordFilterType.PROFANITY,
|
|
870
|
+
inputAction: bedrock.GuardrailAction.BLOCK,
|
|
871
|
+
inputEnabled: true,
|
|
872
|
+
outputAction: bedrock.GuardrailAction.NONE,
|
|
873
|
+
outputEnabled: true,
|
|
874
|
+
});
|
|
875
|
+
|
|
876
|
+
// Add individual words
|
|
877
|
+
guardrail.addWordFilter({text: 'drugs'});
|
|
878
|
+
guardrail.addWordFilter({text: 'competitor'});
|
|
879
|
+
|
|
880
|
+
// Add words from a file
|
|
881
|
+
guardrail.addWordFilterFromFile('./scripts/wordsPolicy.csv');
|
|
882
|
+
```
|
|
883
|
+
|
|
884
|
+
#### PII Filters
|
|
885
|
+
|
|
886
|
+
PII filters allow you to detect and handle personally identifiable information in user inputs and model responses. You can configure separate actions for input and output.
|
|
887
|
+
|
|
888
|
+
The PII types are organized into enum-like classes for better type safety and transpilation compatibility:
|
|
889
|
+
|
|
890
|
+
- **GeneralPIIType**: General PII types like addresses, emails, names, phone numbers
|
|
891
|
+
- **FinancePIIType**: Financial information like credit card numbers, PINs, SWIFT codes
|
|
892
|
+
- **InformationTechnologyPIIType**: IT-related data like URLs, IP addresses, AWS keys
|
|
893
|
+
- **USASpecificPIIType**: US-specific identifiers like SSNs, passport numbers
|
|
894
|
+
- **CanadaSpecificPIIType**: Canada-specific identifiers like health numbers, SINs
|
|
895
|
+
- **UKSpecificPIIType**: UK-specific identifiers like NHS numbers, NI numbers
|
|
896
|
+
|
|
897
|
+
##### PII Filter Configuration
|
|
898
|
+
|
|
899
|
+
```ts fixture=default
|
|
900
|
+
const guardrail = new bedrock.Guardrail(this, 'bedrockGuardrails', {
|
|
901
|
+
guardrailName: 'my-BedrockGuardrails',
|
|
902
|
+
});
|
|
903
|
+
|
|
904
|
+
// Add PII filter for addresses with input/output actions
|
|
905
|
+
guardrail.addPIIFilter({
|
|
906
|
+
type: bedrock.GeneralPIIType.ADDRESS,
|
|
907
|
+
action: bedrock.GuardrailAction.BLOCK,
|
|
908
|
+
// below props are optional
|
|
909
|
+
inputAction: bedrock.GuardrailAction.BLOCK,
|
|
910
|
+
inputEnabled: true,
|
|
911
|
+
outputAction: bedrock.GuardrailAction.ANONYMIZE,
|
|
912
|
+
outputEnabled: true,
|
|
913
|
+
});
|
|
914
|
+
|
|
915
|
+
// Add PII filter for credit card numbers with input/output actions
|
|
916
|
+
guardrail.addPIIFilter({
|
|
917
|
+
type: bedrock.FinancePIIType.CREDIT_DEBIT_CARD_NUMBER,
|
|
918
|
+
action: bedrock.GuardrailAction.BLOCK,
|
|
919
|
+
// below props are optional
|
|
920
|
+
inputAction: bedrock.GuardrailAction.BLOCK,
|
|
921
|
+
inputEnabled: true,
|
|
922
|
+
outputAction: bedrock.GuardrailAction.ANONYMIZE,
|
|
923
|
+
outputEnabled: true,
|
|
924
|
+
});
|
|
925
|
+
|
|
926
|
+
// Add PII filter for email addresses
|
|
927
|
+
guardrail.addPIIFilter({
|
|
928
|
+
type: bedrock.GeneralPIIType.EMAIL,
|
|
929
|
+
action: bedrock.GuardrailAction.ANONYMIZE,
|
|
930
|
+
});
|
|
931
|
+
|
|
932
|
+
// Add PII filter for US Social Security Numbers
|
|
933
|
+
guardrail.addPIIFilter({
|
|
934
|
+
type: bedrock.USASpecificPIIType.US_SOCIAL_SECURITY_NUMBER,
|
|
935
|
+
action: bedrock.GuardrailAction.BLOCK,
|
|
936
|
+
});
|
|
937
|
+
|
|
938
|
+
// Add PII filter for IP addresses
|
|
939
|
+
guardrail.addPIIFilter({
|
|
940
|
+
type: bedrock.InformationTechnologyPIIType.IP_ADDRESS,
|
|
941
|
+
action: bedrock.GuardrailAction.ANONYMIZE,
|
|
942
|
+
});
|
|
943
|
+
```
|
|
944
|
+
|
|
945
|
+
##### Available PII Types
|
|
946
|
+
|
|
947
|
+
**GeneralPIIType:**
|
|
948
|
+
|
|
949
|
+
- `ADDRESS`: Physical addresses
|
|
950
|
+
- `AGE`: Individual's age
|
|
951
|
+
- `DRIVER_ID`: Driver's license numbers
|
|
952
|
+
- `EMAIL`: Email addresses
|
|
953
|
+
- `LICENSE_PLATE`: Vehicle license plates
|
|
954
|
+
- `NAME`: Individual names
|
|
955
|
+
- `PASSWORD`: Passwords
|
|
956
|
+
- `PHONE`: Phone numbers
|
|
957
|
+
- `USERNAME`: User account names
|
|
958
|
+
- `VEHICLE_IDENTIFICATION_NUMBER`: Vehicle VINs
|
|
959
|
+
|
|
960
|
+
**FinancePIIType:**
|
|
961
|
+
|
|
962
|
+
- `CREDIT_DEBIT_CARD_CVV`: Card verification codes
|
|
963
|
+
- `CREDIT_DEBIT_CARD_EXPIRY`: Card expiration dates
|
|
964
|
+
- `CREDIT_DEBIT_CARD_NUMBER`: Credit/debit card numbers
|
|
965
|
+
- `PIN`: Personal identification numbers
|
|
966
|
+
- `SWIFT_CODE`: Bank SWIFT codes
|
|
967
|
+
- `INTERNATIONAL_BANK_ACCOUNT_NUMBER`: IBAN numbers
|
|
968
|
+
|
|
969
|
+
**InformationTechnologyPIIType:**
|
|
970
|
+
|
|
971
|
+
- `URL`: Web addresses
|
|
972
|
+
- `IP_ADDRESS`: IPv4 addresses
|
|
973
|
+
- `MAC_ADDRESS`: Network interface MAC addresses
|
|
974
|
+
- `AWS_ACCESS_KEY`: AWS access key IDs
|
|
975
|
+
- `AWS_SECRET_KEY`: AWS secret access keys
|
|
976
|
+
|
|
977
|
+
**USASpecificPIIType:**
|
|
978
|
+
|
|
979
|
+
- `US_BANK_ACCOUNT_NUMBER`: US bank account numbers
|
|
980
|
+
- `US_BANK_ROUTING_NUMBER`: US bank routing numbers
|
|
981
|
+
- `US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER`: US ITINs
|
|
982
|
+
- `US_PASSPORT_NUMBER`: US passport numbers
|
|
983
|
+
- `US_SOCIAL_SECURITY_NUMBER`: US Social Security Numbers
|
|
984
|
+
|
|
985
|
+
**CanadaSpecificPIIType:**
|
|
986
|
+
|
|
987
|
+
- `CA_HEALTH_NUMBER`: Canadian Health Service Numbers
|
|
988
|
+
- `CA_SOCIAL_INSURANCE_NUMBER`: Canadian Social Insurance Numbers
|
|
989
|
+
|
|
990
|
+
**UKSpecificPIIType:**
|
|
991
|
+
|
|
992
|
+
- `UK_NATIONAL_HEALTH_SERVICE_NUMBER`: UK NHS numbers
|
|
993
|
+
- `UK_NATIONAL_INSURANCE_NUMBER`: UK National Insurance numbers
|
|
994
|
+
- `UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER`: UK UTR numbers
|
|
995
|
+
|
|
996
|
+
#### Regex Filters
|
|
997
|
+
|
|
998
|
+
Regex filters allow you to detect and handle custom patterns in user inputs and model responses. You can configure separate actions for input and output.
|
|
999
|
+
|
|
1000
|
+
##### Regex Filter Configuration
|
|
1001
|
+
|
|
1002
|
+
```ts fixture=default
|
|
1003
|
+
const guardrail = new bedrock.Guardrail(this, 'bedrockGuardrails', {
|
|
1004
|
+
guardrailName: 'my-BedrockGuardrails',
|
|
1005
|
+
});
|
|
1006
|
+
// Add regex filter with input/output actions
|
|
1007
|
+
guardrail.addRegexFilter({
|
|
1008
|
+
name: 'TestRegexFilter',
|
|
1009
|
+
pattern: 'test-pattern',
|
|
1010
|
+
action: bedrock.GuardrailAction.ANONYMIZE,
|
|
1011
|
+
// below props are optional
|
|
1012
|
+
description: 'This is a test regex filter',
|
|
1013
|
+
inputAction: bedrock.GuardrailAction.BLOCK,
|
|
1014
|
+
inputEnabled: true,
|
|
1015
|
+
outputAction: bedrock.GuardrailAction.ANONYMIZE,
|
|
1016
|
+
outputEnabled: true,
|
|
1017
|
+
});
|
|
1018
|
+
```
|
|
1019
|
+
|
|
1020
|
+
#### Contextual Grounding Filters
|
|
1021
|
+
|
|
1022
|
+
Contextual grounding filters allow you to ensure that model responses are factually correct and relevant to the user's query. You can configure the action and enable/disable the filter.
|
|
1023
|
+
|
|
1024
|
+
##### Contextual Grounding Filter Configuration
|
|
1025
|
+
|
|
1026
|
+
```ts fixture=default
|
|
1027
|
+
const guardrail = new bedrock.Guardrail(this, 'bedrockGuardrails', {
|
|
1028
|
+
guardrailName: 'my-BedrockGuardrails',
|
|
1029
|
+
});
|
|
1030
|
+
// Add contextual grounding filter with action and enabled flag
|
|
1031
|
+
guardrail.addContextualGroundingFilter({
|
|
1032
|
+
type: bedrock.ContextualGroundingFilterType.GROUNDING,
|
|
1033
|
+
threshold: 0.8,
|
|
1034
|
+
// the properties below are optional
|
|
1035
|
+
action: bedrock.GuardrailAction.BLOCK,
|
|
1036
|
+
enabled: true,
|
|
1037
|
+
});
|
|
1038
|
+
```
|
|
1039
|
+
|
|
1040
|
+
### Guardrail Methods
|
|
1041
|
+
|
|
1042
|
+
| Method | Description |
|
|
1043
|
+
|--------|-------------|
|
|
1044
|
+
| `addContentFilter()` | Adds a content filter to the guardrail |
|
|
1045
|
+
| `addDeniedTopicFilter()` | Adds a denied topic filter to the guardrail |
|
|
1046
|
+
| `addWordFilter()` | Adds a word filter to the guardrail |
|
|
1047
|
+
| `addManagedWordListFilter()` | Adds a managed word list filter to the guardrail |
|
|
1048
|
+
| `addWordFilterFromFile()` | Adds word filters from a file to the guardrail |
|
|
1049
|
+
| `addPIIFilter()` | Adds a PII filter to the guardrail |
|
|
1050
|
+
| `addRegexFilter()` | Adds a regex filter to the guardrail |
|
|
1051
|
+
| `addContextualGroundingFilter()` | Adds a contextual grounding filter to the guardrail |
|
|
1052
|
+
| `createVersion()` | Creates a new version of the guardrail |
|
|
1053
|
+
|
|
1054
|
+
### Guardrail Permissions
|
|
1055
|
+
|
|
1056
|
+
Guardrails provide methods to grant permissions to other resources that need to interact with the guardrail.
|
|
1057
|
+
|
|
1058
|
+
#### Permission Methods
|
|
1059
|
+
|
|
1060
|
+
| Method | Description | Parameters |
|
|
1061
|
+
|--------|-------------|------------|
|
|
1062
|
+
| `grant(grantee, ...actions)` | Grants the given principal identity permissions to perform actions on this guardrail | `grantee`: The principal to grant permissions to<br>`actions`: The actions to grant (e.g., `bedrock:GetGuardrail`, `bedrock:ListGuardrails`) |
|
|
1063
|
+
| `grantApply(grantee)` | Grants the given identity permissions to apply the guardrail | `grantee`: The principal to grant permissions to |
|
|
1064
|
+
|
|
1065
|
+
#### Permission Examples
|
|
1066
|
+
|
|
1067
|
+
```ts fixture=default
|
|
1068
|
+
const guardrail = new bedrock.Guardrail(this, 'bedrockGuardrails', {
|
|
1069
|
+
guardrailName: 'my-BedrockGuardrails',
|
|
1070
|
+
});
|
|
1071
|
+
|
|
1072
|
+
const lambdaFunction = new lambda.Function(this, 'testLambda', {
|
|
1073
|
+
runtime: lambda.Runtime.PYTHON_3_12,
|
|
1074
|
+
handler: 'index.handler',
|
|
1075
|
+
code: lambda.Code.fromAsset(path.join(__dirname, '../lambda/my-code')),
|
|
1076
|
+
});
|
|
1077
|
+
|
|
1078
|
+
// Grant specific permissions to a Lambda function
|
|
1079
|
+
guardrail.grant(lambdaFunction, 'bedrock:GetGuardrail', 'bedrock:ListGuardrails');
|
|
1080
|
+
|
|
1081
|
+
// Grant permissions to apply the guardrail
|
|
1082
|
+
guardrail.grantApply(lambdaFunction);
|
|
1083
|
+
```
|
|
1084
|
+
|
|
1085
|
+
### Guardrail Metrics
|
|
1086
|
+
|
|
1087
|
+
Amazon Bedrock provides metrics for your guardrails, allowing you to monitor their effectiveness and usage. These metrics are available in CloudWatch and can be used to create dashboards and alarms.
|
|
1088
|
+
|
|
1089
|
+
#### Metrics Examples
|
|
1090
|
+
|
|
1091
|
+
```ts fixture=default
|
|
1092
|
+
import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';
|
|
1093
|
+
|
|
1094
|
+
const guardrail = new bedrock.Guardrail(this, 'bedrockGuardrails', {
|
|
1095
|
+
guardrailName: 'my-BedrockGuardrails',
|
|
1096
|
+
});
|
|
1097
|
+
// Get a specific metric for this guardrail
|
|
1098
|
+
const invocationsMetric = guardrail.metricInvocations({
|
|
1099
|
+
statistic: 'Sum',
|
|
1100
|
+
period: Duration.minutes(5),
|
|
1101
|
+
});
|
|
1102
|
+
|
|
1103
|
+
// Create a CloudWatch alarm for high invocation latency
|
|
1104
|
+
new cloudwatch.Alarm(this, 'HighLatencyAlarm', {
|
|
1105
|
+
metric: guardrail.metricInvocationLatency(),
|
|
1106
|
+
threshold: 1000, // 1 second
|
|
1107
|
+
evaluationPeriods: 3,
|
|
1108
|
+
});
|
|
1109
|
+
|
|
1110
|
+
// Get metrics for all guardrails
|
|
1111
|
+
const allInvocationsMetric = bedrock.Guardrail.metricAllInvocations();
|
|
1112
|
+
```
|
|
1113
|
+
|
|
1114
|
+
### Importing Guardrails
|
|
1115
|
+
|
|
1116
|
+
You can import existing guardrails using the `fromGuardrailAttributes` or `fromCfnGuardrail` methods.
|
|
1117
|
+
|
|
1118
|
+
#### Import Configuration
|
|
1119
|
+
|
|
1120
|
+
```ts fixture=default
|
|
1121
|
+
declare const stack: Stack;
|
|
1122
|
+
const cmk = new kms.Key(this, 'cmk', {});
|
|
1123
|
+
// Import an existing guardrail by ARN
|
|
1124
|
+
const importedGuardrail = bedrock.Guardrail.fromGuardrailAttributes(stack, 'TestGuardrail', {
|
|
1125
|
+
guardrailArn: 'arn:aws:bedrock:us-east-1:123456789012:guardrail/oygh3o8g7rtl',
|
|
1126
|
+
guardrailVersion: '1', //optional
|
|
1127
|
+
kmsKey: cmk, //optional
|
|
1128
|
+
});
|
|
1129
|
+
```
|
|
1130
|
+
|
|
1131
|
+
```ts fixture=default
|
|
1132
|
+
import * as bedrockl1 from 'aws-cdk-lib/aws-bedrock';
|
|
1133
|
+
// Import a guardrail created through the L1 CDK CfnGuardrail construct
|
|
1134
|
+
const l1guardrail = new bedrockl1.CfnGuardrail(this, 'MyCfnGuardrail', {
|
|
1135
|
+
blockedInputMessaging: 'blockedInputMessaging',
|
|
1136
|
+
blockedOutputsMessaging: 'blockedOutputsMessaging',
|
|
1137
|
+
name: 'namemycfnguardrails',
|
|
1138
|
+
wordPolicyConfig: {
|
|
1139
|
+
wordsConfig: [
|
|
1140
|
+
{
|
|
1141
|
+
text: 'drugs',
|
|
1142
|
+
},
|
|
1143
|
+
],
|
|
1144
|
+
},
|
|
1145
|
+
});
|
|
1146
|
+
|
|
1147
|
+
const importedGuardrail = bedrock.Guardrail.fromCfnGuardrail(l1guardrail);
|
|
1148
|
+
```
|
|
1149
|
+
|
|
1150
|
+
### Guardrail Versioning
|
|
1151
|
+
|
|
1152
|
+
Guardrails support versioning, allowing you to track changes and maintain multiple versions of your guardrail configurations.
|
|
1153
|
+
|
|
1154
|
+
#### Version Configuration
|
|
1155
|
+
|
|
1156
|
+
```ts fixture=default
|
|
1157
|
+
const guardrail = new bedrock.Guardrail(this, 'bedrockGuardrails', {
|
|
1158
|
+
guardrailName: 'my-BedrockGuardrails',
|
|
1159
|
+
});
|
|
1160
|
+
// Create a new version of the guardrail
|
|
1161
|
+
guardrail.createVersion('testversion');
|
|
1162
|
+
```
|
|
1163
|
+
|
|
1164
|
+
## Prompts
|
|
1165
|
+
|
|
1166
|
+
Amazon Bedrock provides the ability to create and save prompts using Prompt management so that you can save time by applying the same prompt to different workflows. You can include variables in the prompt so that you can adjust the prompt for different use case.
|
|
1167
|
+
|
|
1168
|
+
The `Prompt` resource allows you to create a new prompt.
|
|
1169
|
+
|
|
1170
|
+
### Prompt Variants
|
|
1171
|
+
|
|
1172
|
+
Prompt variants in the context of Amazon Bedrock refer to alternative configurations of a prompt, including its message or the model and inference configurations used. Prompt variants are the building blocks of prompts - you must create at least one prompt variant to create a prompt. Prompt variants allow you to create different versions of a prompt, test them, and save the variant that works best for your use case.
|
|
1173
|
+
|
|
1174
|
+
There are three types of prompt variants:
|
|
1175
|
+
|
|
1176
|
+
- **Basic Text Prompt**: Simple text-based prompts for straightforward interactions
|
|
1177
|
+
- **Chat variant**: Conversational prompts that support system messages, user/assistant message history, and tools
|
|
1178
|
+
- **Agent variant**: Prompts designed to work with Bedrock Agents
|
|
1179
|
+
|
|
1180
|
+
### Basic Text Prompt
|
|
1181
|
+
|
|
1182
|
+
Text prompts are the simplest form of prompts, consisting of plain text instructions with optional variables. They are ideal for straightforward tasks like summarization, content generation, or question answering where you need a direct text-based interaction with the model.
|
|
1183
|
+
|
|
1184
|
+
```ts fixture=default
|
|
1185
|
+
const cmk = new kms.Key(this, 'cmk', {});
|
|
1186
|
+
const claudeModel = bedrock.BedrockFoundationModel.ANTHROPIC_CLAUDE_SONNET_V1_0;
|
|
1187
|
+
|
|
1188
|
+
const variant1 = bedrock.PromptVariant.text({
|
|
1189
|
+
variantName: 'variant1',
|
|
1190
|
+
model: claudeModel,
|
|
1191
|
+
promptVariables: ['topic'],
|
|
1192
|
+
promptText: 'This is my first text prompt. Please summarize our conversation on: {{topic}}.',
|
|
1193
|
+
inferenceConfiguration: bedrock.PromptInferenceConfiguration.text({
|
|
1194
|
+
temperature: 1.0,
|
|
1195
|
+
topP: 0.999,
|
|
1196
|
+
maxTokens: 2000,
|
|
1197
|
+
}),
|
|
1198
|
+
});
|
|
1199
|
+
|
|
1200
|
+
const prompt1 = new bedrock.Prompt(this, 'prompt1', {
|
|
1201
|
+
promptName: 'prompt1',
|
|
1202
|
+
description: 'my first prompt',
|
|
1203
|
+
defaultVariant: variant1,
|
|
1204
|
+
variants: [variant1],
|
|
1205
|
+
kmsKey: cmk,
|
|
1206
|
+
});
|
|
1207
|
+
```
|
|
1208
|
+
|
|
1209
|
+
### Chat Prompt
|
|
1210
|
+
|
|
1211
|
+
Use this template type when the model supports the Converse API or the Anthropic Claude Messages API. This allows you to include a System prompt and previous User messages and Assistant messages for context.
|
|
1212
|
+
|
|
1213
|
+
```ts fixture=default
|
|
1214
|
+
const cmk = new kms.Key(this, 'cmk', {});
|
|
1215
|
+
|
|
1216
|
+
const variantChat = bedrock.PromptVariant.chat({
|
|
1217
|
+
variantName: 'variant1',
|
|
1218
|
+
model: bedrock.BedrockFoundationModel.ANTHROPIC_CLAUDE_3_5_SONNET_V1_0,
|
|
1219
|
+
messages: [
|
|
1220
|
+
bedrock.ChatMessage.user('From now on, you speak Japanese!'),
|
|
1221
|
+
bedrock.ChatMessage.assistant('Konnichiwa!'),
|
|
1222
|
+
bedrock.ChatMessage.user('From now on, you speak {{language}}!'),
|
|
1223
|
+
],
|
|
1224
|
+
system: 'You are a helpful assistant that only speaks the language you`re told.',
|
|
1225
|
+
promptVariables: ['language'],
|
|
1226
|
+
toolConfiguration: {
|
|
1227
|
+
toolChoice: bedrock.ToolChoice.AUTO,
|
|
1228
|
+
tools: [
|
|
1229
|
+
bedrock.Tool.function({
|
|
1230
|
+
name: 'top_song',
|
|
1231
|
+
description: 'Get the most popular song played on a radio station.',
|
|
1232
|
+
inputSchema: {
|
|
1233
|
+
type: 'object',
|
|
1234
|
+
properties: {
|
|
1235
|
+
sign: {
|
|
1236
|
+
type: 'string',
|
|
1237
|
+
description: 'The call sign for the radio station for which you want the most popular song. Example calls signs are WZPZ and WKR.',
|
|
1238
|
+
},
|
|
1239
|
+
},
|
|
1240
|
+
required: ['sign'],
|
|
1241
|
+
},
|
|
1242
|
+
}),
|
|
1243
|
+
],
|
|
1244
|
+
},
|
|
1245
|
+
});
|
|
1246
|
+
|
|
1247
|
+
new bedrock.Prompt(this, 'prompt1', {
|
|
1248
|
+
promptName: 'prompt-chat',
|
|
1249
|
+
description: 'my first chat prompt',
|
|
1250
|
+
defaultVariant: variantChat,
|
|
1251
|
+
variants: [variantChat],
|
|
1252
|
+
kmsKey: cmk,
|
|
1253
|
+
});
|
|
1254
|
+
```
|
|
1255
|
+
|
|
1256
|
+
### Agent Prompt
|
|
1257
|
+
|
|
1258
|
+
Agent prompts are designed to work with Bedrock Agents, allowing you to create prompts that can be used by agents to perform specific tasks. Agent prompts use text prompts as their foundation and can reference agent aliases and include custom instructions for how the agent should behave.
|
|
1259
|
+
|
|
1260
|
+
```ts fixture=default
|
|
1261
|
+
const cmk = new kms.Key(this, 'cmk', {});
|
|
1262
|
+
|
|
1263
|
+
// Assuming you have an existing agent and alias
|
|
1264
|
+
const agent = bedrock.Agent.fromAgentAttributes(this, 'ImportedAgent', {
|
|
1265
|
+
agentArn: 'arn:aws:bedrock:region:account:agent/agent-id',
|
|
1266
|
+
roleArn: 'arn:aws:iam::account:role/agent-role',
|
|
1267
|
+
});
|
|
1268
|
+
|
|
1269
|
+
const agentAlias = bedrock.AgentAlias.fromAttributes(this, 'ImportedAlias', {
|
|
1270
|
+
aliasId: 'alias-id',
|
|
1271
|
+
aliasName: 'my-alias',
|
|
1272
|
+
agentVersion: '1',
|
|
1273
|
+
agent: agent,
|
|
1274
|
+
});
|
|
1275
|
+
|
|
1276
|
+
const agentVariant = bedrock.PromptVariant.agent({
|
|
1277
|
+
variantName: 'agent-variant',
|
|
1278
|
+
model: bedrock.BedrockFoundationModel.ANTHROPIC_CLAUDE_3_5_SONNET_V1_0,
|
|
1279
|
+
agentAlias: agentAlias,
|
|
1280
|
+
promptText: 'Use the agent to help with: {{task}}. Please be thorough and provide detailed explanations.',
|
|
1281
|
+
promptVariables: ['task'],
|
|
1282
|
+
});
|
|
1283
|
+
|
|
1284
|
+
new bedrock.Prompt(this, 'agentPrompt', {
|
|
1285
|
+
promptName: 'agent-prompt',
|
|
1286
|
+
description: 'Prompt for agent interactions',
|
|
1287
|
+
defaultVariant: agentVariant,
|
|
1288
|
+
variants: [agentVariant],
|
|
1289
|
+
kmsKey: cmk,
|
|
1290
|
+
});
|
|
1291
|
+
```
|
|
1292
|
+
|
|
1293
|
+
### Prompt Properties
|
|
1294
|
+
|
|
1295
|
+
| Property | Type | Required | Description |
|
|
1296
|
+
|----------|------|----------|-------------|
|
|
1297
|
+
| promptName | string | Yes | The name of the prompt |
|
|
1298
|
+
| description | string | No | A description of the prompt |
|
|
1299
|
+
| defaultVariant | PromptVariant | Yes | The default variant to use for the prompt |
|
|
1300
|
+
| variants | PromptVariant[] | No | Additional variants for the prompt |
|
|
1301
|
+
| kmsKey | kms.IKey | No | The KMS key to use for encrypting the prompt. Defaults to AWS managed key |
|
|
1302
|
+
| tags | Record<string, string> | No | Tags to apply to the prompt |
|
|
1303
|
+
|
|
1304
|
+
### Prompt Version
|
|
1305
|
+
|
|
1306
|
+
A prompt version is a snapshot of a prompt at a specific point in time that you create when you are satisfied with a set of configurations. Versions allow you to deploy your prompt and easily switch between different configurations for your prompt and update your application with the most appropriate version for your use-case.
|
|
1307
|
+
|
|
1308
|
+
You can create a Prompt version by using the PromptVersion class or by using the .createVersion(..) on a Prompt object. It is recommended to use the .createVersion(..) method. It uses a hash based mechanism to update the version whenever a certain configuration property changes.
|
|
1309
|
+
|
|
1310
|
+
```ts fixture=default
|
|
1311
|
+
const cmk = new kms.Key(this, 'cmk', {});
|
|
1312
|
+
const claudeModel = bedrock.BedrockFoundationModel.ANTHROPIC_CLAUDE_SONNET_V1_0;
|
|
1313
|
+
|
|
1314
|
+
const variant1 = bedrock.PromptVariant.text({
|
|
1315
|
+
variantName: 'variant1',
|
|
1316
|
+
model: claudeModel,
|
|
1317
|
+
promptVariables: ['topic'],
|
|
1318
|
+
promptText: 'This is my first text prompt. Please summarize our conversation on: {{topic}}.',
|
|
1319
|
+
inferenceConfiguration: bedrock.PromptInferenceConfiguration.text({
|
|
1320
|
+
temperature: 1.0,
|
|
1321
|
+
topP: 0.999,
|
|
1322
|
+
maxTokens: 2000,
|
|
1323
|
+
}),
|
|
1324
|
+
});
|
|
1325
|
+
|
|
1326
|
+
const prompt1 = new bedrock.Prompt(this, 'prompt1', {
|
|
1327
|
+
promptName: 'prompt1',
|
|
1328
|
+
description: 'my first prompt',
|
|
1329
|
+
defaultVariant: variant1,
|
|
1330
|
+
variants: [variant1],
|
|
1331
|
+
kmsKey: cmk,
|
|
1332
|
+
});
|
|
1333
|
+
|
|
1334
|
+
const promptVersion = new bedrock.PromptVersion(this, 'MyPromptVersion', {
|
|
1335
|
+
prompt: prompt1,
|
|
1336
|
+
description: 'my first version',
|
|
1337
|
+
});
|
|
1338
|
+
//or alternatively:
|
|
1339
|
+
// const promptVersion = prompt1.createVersion('my first version');
|
|
1340
|
+
const versionString = promptVersion.version;
|
|
1341
|
+
|
|
1342
|
+
```
|
|
1343
|
+
|
|
1344
|
+
### Import Methods
|
|
1345
|
+
|
|
1346
|
+
You can use the `fromPromptAttributes` method to import an existing Bedrock Prompt into your CDK application.
|
|
1347
|
+
|
|
1348
|
+
```ts fixture=default
|
|
1349
|
+
// Import an existing prompt by ARN
|
|
1350
|
+
const importedPrompt = bedrock.Prompt.fromPromptAttributes(this, 'ImportedPrompt', {
|
|
1351
|
+
promptArn: 'arn:aws:bedrock:region:account:prompt/prompt-id',
|
|
1352
|
+
kmsKey: kms.Key.fromKeyArn(this, 'ImportedKey', 'arn:aws:kms:region:account:key/key-id'), // optional
|
|
1353
|
+
promptVersion: '1', // optional, defaults to 'DRAFT'
|
|
1354
|
+
});
|
|
1355
|
+
```
|
|
1356
|
+
|
|
1357
|
+
## Inference Profiles
|
|
1358
|
+
|
|
1359
|
+
Amazon Bedrock Inference Profiles provide a way to manage and optimize inference configurations for your foundation models. They allow you to define reusable configurations that can be applied across different prompts and agents.
|
|
1360
|
+
|
|
1361
|
+
### Using Inference Profiles
|
|
1362
|
+
|
|
1363
|
+
Inference profiles can be used with prompts and agents to maintain consistent inference configurations across your application.
|
|
1364
|
+
|
|
1365
|
+
#### With Agents
|
|
1366
|
+
|
|
1367
|
+
```ts fixture=default
|
|
1368
|
+
// Create a cross-region inference profile
|
|
1369
|
+
const crossRegionProfile = bedrock.CrossRegionInferenceProfile.fromConfig({
|
|
1370
|
+
geoRegion: bedrock.CrossRegionInferenceProfileRegion.US,
|
|
1371
|
+
model: bedrock.BedrockFoundationModel.ANTHROPIC_CLAUDE_3_5_SONNET_V1_0,
|
|
1372
|
+
});
|
|
1373
|
+
|
|
1374
|
+
// Use the cross-region profile with an agent
|
|
1375
|
+
const agent = new bedrock.Agent(this, 'Agent', {
|
|
1376
|
+
foundationModel: crossRegionProfile,
|
|
1377
|
+
instruction: 'You are a helpful and friendly agent that answers questions about agriculture.',
|
|
1378
|
+
});
|
|
1379
|
+
```
|
|
1380
|
+
|
|
1381
|
+
#### With Prompts
|
|
1382
|
+
|
|
1383
|
+
```ts fixture=default
|
|
1384
|
+
// Create a prompt router for intelligent model selection
|
|
1385
|
+
const promptRouter = bedrock.PromptRouter.fromDefaultId(
|
|
1386
|
+
bedrock.DefaultPromptRouterIdentifier.ANTHROPIC_CLAUDE_V1,
|
|
1387
|
+
'us-east-1'
|
|
1388
|
+
);
|
|
1389
|
+
|
|
1390
|
+
// Use the prompt router with a prompt variant
|
|
1391
|
+
const variant = bedrock.PromptVariant.text({
|
|
1392
|
+
variantName: 'variant1',
|
|
1393
|
+
promptText: 'What is the capital of France?',
|
|
1394
|
+
model: promptRouter,
|
|
1395
|
+
});
|
|
1396
|
+
|
|
1397
|
+
new bedrock.Prompt(this, 'Prompt', {
|
|
1398
|
+
promptName: 'prompt-router-test',
|
|
1399
|
+
variants: [variant],
|
|
1400
|
+
});
|
|
1401
|
+
```
|
|
1402
|
+
|
|
1403
|
+
### Types of Inference Profiles
|
|
1404
|
+
|
|
1405
|
+
Amazon Bedrock offers two types of inference profiles:
|
|
1406
|
+
|
|
1407
|
+
#### Application Inference Profiles
|
|
1408
|
+
|
|
1409
|
+
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.
|
|
1410
|
+
|
|
1411
|
+
##### Single Region Application Profile
|
|
1412
|
+
|
|
1413
|
+
```ts fixture=default
|
|
1414
|
+
// Create an application inference profile for one Region
|
|
1415
|
+
const appProfile = new bedrock.ApplicationInferenceProfile(this, 'MyApplicationProfile', {
|
|
1416
|
+
applicationInferenceProfileName: 'claude-3-sonnet-v1',
|
|
1417
|
+
modelSource: bedrock.BedrockFoundationModel.ANTHROPIC_CLAUDE_SONNET_V1_0,
|
|
1418
|
+
description: 'Application profile for cost tracking',
|
|
1419
|
+
tags: {
|
|
1420
|
+
Environment: 'Production',
|
|
1421
|
+
},
|
|
1422
|
+
});
|
|
1423
|
+
```
|
|
1424
|
+
|
|
1425
|
+
##### Multi-Region Application Profile
|
|
1426
|
+
|
|
1427
|
+
```ts fixture=default
|
|
1428
|
+
// Create a cross-region inference profile
|
|
1429
|
+
const crossRegionProfile = bedrock.CrossRegionInferenceProfile.fromConfig({
|
|
1430
|
+
geoRegion: bedrock.CrossRegionInferenceProfileRegion.US,
|
|
1431
|
+
model: bedrock.BedrockFoundationModel.ANTHROPIC_CLAUDE_3_5_SONNET_V2_0,
|
|
1432
|
+
});
|
|
1433
|
+
|
|
1434
|
+
// Create an application inference profile across regions
|
|
1435
|
+
const appProfile = new bedrock.ApplicationInferenceProfile(this, 'MyMultiRegionProfile', {
|
|
1436
|
+
applicationInferenceProfileName: 'claude-35-sonnet-v2-multi-region',
|
|
1437
|
+
modelSource: crossRegionProfile,
|
|
1438
|
+
description: 'Multi-region application profile for cost tracking',
|
|
1439
|
+
});
|
|
1440
|
+
```
|
|
1441
|
+
|
|
1442
|
+
#### System Defined Inference Profiles
|
|
1443
|
+
|
|
1444
|
+
Cross-region inference enables you to seamlessly manage unplanned traffic bursts by utilizing compute across different AWS Regions. With cross-region inference, you can distribute traffic across multiple AWS Regions, enabling higher throughput and enhanced resilience during periods of peak demands.
|
|
1445
|
+
|
|
1446
|
+
Before using a CrossRegionInferenceProfile, ensure that you have access to the models and regions defined in the inference profiles. For instance, if you use the system defined inference profile "us.anthropic.claude-3-5-sonnet-20241022-v2:0", inference requests will be routed to US East (Virginia) us-east-1, US East (Ohio) us-east-2 and US West (Oregon) us-west-2. Thus, you need to have model access enabled in those regions for the model anthropic.claude-3-5-sonnet-20241022-v2:0.
|
|
1447
|
+
|
|
1448
|
+
##### System Defined Profile Configuration
|
|
1449
|
+
|
|
1450
|
+
```ts fixture=default
|
|
1451
|
+
const crossRegionProfile = bedrock.CrossRegionInferenceProfile.fromConfig({
|
|
1452
|
+
geoRegion: bedrock.CrossRegionInferenceProfileRegion.US,
|
|
1453
|
+
model: bedrock.BedrockFoundationModel.ANTHROPIC_CLAUDE_3_5_SONNET_V2_0,
|
|
1454
|
+
});
|
|
1455
|
+
```
|
|
1456
|
+
|
|
1457
|
+
### Prompt Routers
|
|
1458
|
+
|
|
1459
|
+
Amazon Bedrock intelligent prompt routing provides a single serverless endpoint for efficiently routing requests between different foundational models within the same model family. It can help you optimize for response quality and cost. They offer a comprehensive solution for managing multiple AI models through a single serverless endpoint, simplifying the process for you. Intelligent prompt routing predicts the performance of each model for each request, and dynamically routes each request to the model that it predicts is most likely to give the desired response at the lowest cost.
|
|
1460
|
+
|
|
1461
|
+
#### Default and Custom Prompt Routers
|
|
1462
|
+
|
|
1463
|
+
```ts fixture=default
|
|
1464
|
+
// Use a default prompt router
|
|
1465
|
+
const variant = bedrock.PromptVariant.text({
|
|
1466
|
+
variantName: 'variant1',
|
|
1467
|
+
promptText: 'What is the capital of France?',
|
|
1468
|
+
model: bedrock.PromptRouter.fromDefaultId(
|
|
1469
|
+
bedrock.DefaultPromptRouterIdentifier.ANTHROPIC_CLAUDE_V1,
|
|
1470
|
+
'us-east-1'
|
|
1471
|
+
),
|
|
1472
|
+
});
|
|
1473
|
+
|
|
1474
|
+
new bedrock.Prompt(this, 'Prompt', {
|
|
1475
|
+
promptName: 'prompt-router-test',
|
|
1476
|
+
variants: [variant],
|
|
1477
|
+
});
|
|
1478
|
+
```
|
|
1479
|
+
|
|
1480
|
+
### Inference Profile Permissions
|
|
1481
|
+
|
|
1482
|
+
Use the `grantProfileUsage` method to grant appropriate permissions to resources that need to use the inference profile.
|
|
1483
|
+
|
|
1484
|
+
#### Granting Profile Usage Permissions
|
|
1485
|
+
|
|
1486
|
+
```ts fixture=default
|
|
1487
|
+
// Create an application inference profile
|
|
1488
|
+
const profile = new bedrock.ApplicationInferenceProfile(this, 'MyProfile', {
|
|
1489
|
+
applicationInferenceProfileName: 'my-profile',
|
|
1490
|
+
modelSource: bedrock.BedrockFoundationModel.ANTHROPIC_CLAUDE_SONNET_4_5_V1_0,
|
|
1491
|
+
});
|
|
1492
|
+
|
|
1493
|
+
// Create a Lambda function
|
|
1494
|
+
const lambdaFunction = new lambda.Function(this, 'MyFunction', {
|
|
1495
|
+
runtime: lambda.Runtime.PYTHON_3_11,
|
|
1496
|
+
handler: 'index.handler',
|
|
1497
|
+
code: lambda.Code.fromInline('def handler(event, context): return "Hello"'),
|
|
1498
|
+
});
|
|
1499
|
+
|
|
1500
|
+
// Grant the Lambda function permission to use the inference profile
|
|
1501
|
+
profile.grantProfileUsage(lambdaFunction);
|
|
1502
|
+
|
|
1503
|
+
// Use a system defined inference profile
|
|
1504
|
+
const crossRegionProfile = bedrock.CrossRegionInferenceProfile.fromConfig({
|
|
1505
|
+
geoRegion: bedrock.CrossRegionInferenceProfileRegion.US,
|
|
1506
|
+
model: bedrock.BedrockFoundationModel.ANTHROPIC_CLAUDE_SONNET_4_5_V1_0,
|
|
1507
|
+
});
|
|
1508
|
+
|
|
1509
|
+
// Grant permissions to use the cross-region inference profile
|
|
1510
|
+
crossRegionProfile.grantProfileUsage(lambdaFunction);
|
|
1511
|
+
```
|
|
1512
|
+
|
|
1513
|
+
The `grantProfileUsage` method adds the necessary IAM permissions to the resource, allowing it to use the inference profile. This includes permissions to call `bedrock:GetInferenceProfile` and `bedrock:ListInferenceProfiles` actions on the inference profile resource.
|
|
1514
|
+
|
|
1515
|
+
### Inference Profiles Import Methods
|
|
1516
|
+
|
|
1517
|
+
You can import existing application inference profiles using the following methods:
|
|
1518
|
+
|
|
1519
|
+
```ts fixture=default
|
|
1520
|
+
// Import an inference profile through attributes
|
|
1521
|
+
const importedProfile = bedrock.ApplicationInferenceProfile.fromApplicationInferenceProfileAttributes(
|
|
1522
|
+
this,
|
|
1523
|
+
'ImportedProfile',
|
|
1524
|
+
{
|
|
1525
|
+
inferenceProfileArn: 'arn:aws:bedrock:us-east-1:123456789012:application-inference-profile/my-profile-id',
|
|
1526
|
+
inferenceProfileIdentifier: 'my-profile-id',
|
|
1527
|
+
}
|
|
1528
|
+
);
|
|
1529
|
+
```
|
|
1530
|
+
|
|
1531
|
+
You can also import an application inference profile from an existing L1 CloudFormation construct:
|
|
1532
|
+
|
|
1533
|
+
```ts fixture=default
|
|
1534
|
+
// Create or reference an existing L1 CfnApplicationInferenceProfile
|
|
1535
|
+
const cfnProfile = new aws_bedrock_cfn.CfnApplicationInferenceProfile(this, 'CfnProfile', {
|
|
1536
|
+
inferenceProfileName: 'my-cfn-profile',
|
|
1537
|
+
modelSource: {
|
|
1538
|
+
copyFrom: bedrock.BedrockFoundationModel.ANTHROPIC_CLAUDE_3_5_SONNET_V1_0.invokableArn,
|
|
1539
|
+
},
|
|
1540
|
+
description: 'Profile created via L1 construct',
|
|
1541
|
+
});
|
|
1542
|
+
|
|
1543
|
+
// Import the L1 construct as an L2 ApplicationInferenceProfile
|
|
1544
|
+
const importedFromCfn = bedrock.ApplicationInferenceProfile.fromCfnApplicationInferenceProfile(cfnProfile);
|
|
1545
|
+
|
|
1546
|
+
// Grant permissions to use the imported profile
|
|
1547
|
+
const lambdaFunction = new lambda.Function(this, 'MyFunction', {
|
|
1548
|
+
runtime: lambda.Runtime.PYTHON_3_11,
|
|
1549
|
+
handler: 'index.handler',
|
|
1550
|
+
code: lambda.Code.fromInline('def handler(event, context): return "Hello"'),
|
|
1551
|
+
});
|
|
1552
|
+
|
|
1553
|
+
importedFromCfn.grantProfileUsage(lambdaFunction);
|
|
1554
|
+
```
|