@aws/agentcore-cdk 0.1.0-alpha.9 → 1.0.0-rc.2
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.
- package/README.md +267 -40
- package/dist/cdk/constants.d.ts +1 -0
- package/dist/cdk/constants.d.ts.map +1 -1
- package/dist/cdk/constants.js +2 -1
- package/dist/cdk/constants.js.map +1 -1
- package/dist/cdk/constructs/bundling/container/ContainerSourceAsset.d.ts +26 -4
- package/dist/cdk/constructs/bundling/container/ContainerSourceAsset.d.ts.map +1 -1
- package/dist/cdk/constructs/bundling/container/ContainerSourceAsset.js +69 -10
- package/dist/cdk/constructs/bundling/container/ContainerSourceAsset.js.map +1 -1
- package/dist/cdk/constructs/bundling/container/ContainerSourceAssetFromPath.d.ts +17 -0
- package/dist/cdk/constructs/bundling/container/ContainerSourceAssetFromPath.d.ts.map +1 -0
- package/dist/cdk/constructs/bundling/container/ContainerSourceAssetFromPath.js +20 -0
- package/dist/cdk/constructs/bundling/container/ContainerSourceAssetFromPath.js.map +1 -0
- package/dist/cdk/constructs/bundling/container/index.d.ts +1 -0
- package/dist/cdk/constructs/bundling/container/index.d.ts.map +1 -1
- package/dist/cdk/constructs/bundling/container/index.js +3 -1
- package/dist/cdk/constructs/bundling/container/index.js.map +1 -1
- package/dist/cdk/constructs/bundling/index.d.ts +2 -0
- package/dist/cdk/constructs/bundling/index.d.ts.map +1 -1
- package/dist/cdk/constructs/bundling/index.js +6 -2
- package/dist/cdk/constructs/bundling/index.js.map +1 -1
- package/dist/cdk/constructs/bundling/zip/BundledCodeZipAsset.d.ts +5 -0
- package/dist/cdk/constructs/bundling/zip/BundledCodeZipAsset.d.ts.map +1 -1
- package/dist/cdk/constructs/bundling/zip/BundledCodeZipAsset.js +2 -7
- package/dist/cdk/constructs/bundling/zip/BundledCodeZipAsset.js.map +1 -1
- package/dist/cdk/constructs/bundling/zip/NodeBundledCodeZipAsset.d.ts +7 -0
- package/dist/cdk/constructs/bundling/zip/NodeBundledCodeZipAsset.d.ts.map +1 -0
- package/dist/cdk/constructs/bundling/zip/NodeBundledCodeZipAsset.js +30 -0
- package/dist/cdk/constructs/bundling/zip/NodeBundledCodeZipAsset.js.map +1 -0
- package/dist/cdk/constructs/bundling/zip/index.d.ts +1 -0
- package/dist/cdk/constructs/bundling/zip/index.d.ts.map +1 -1
- package/dist/cdk/constructs/bundling/zip/index.js +3 -1
- package/dist/cdk/constructs/bundling/zip/index.js.map +1 -1
- package/dist/cdk/constructs/components/base-props.d.ts +9 -2
- package/dist/cdk/constructs/components/base-props.d.ts.map +1 -1
- package/dist/cdk/constructs/components/container/ContainerBuildProject.d.ts +35 -8
- package/dist/cdk/constructs/components/container/ContainerBuildProject.d.ts.map +1 -1
- package/dist/cdk/constructs/components/container/ContainerBuildProject.js +117 -13
- package/dist/cdk/constructs/components/container/ContainerBuildProject.js.map +1 -1
- package/dist/cdk/constructs/components/container/ContainerImageBuilder.d.ts +25 -7
- package/dist/cdk/constructs/components/container/ContainerImageBuilder.d.ts.map +1 -1
- package/dist/cdk/constructs/components/container/ContainerImageBuilder.js +45 -7
- package/dist/cdk/constructs/components/container/ContainerImageBuilder.js.map +1 -1
- package/dist/cdk/constructs/components/container/ContainerRepository.d.ts +30 -0
- package/dist/cdk/constructs/components/container/ContainerRepository.d.ts.map +1 -0
- package/dist/cdk/constructs/components/container/{AgentEcrRepository.js → ContainerRepository.js} +19 -8
- package/dist/cdk/constructs/components/container/ContainerRepository.js.map +1 -0
- package/dist/cdk/constructs/components/container/container-build-handler.d.ts +4 -1
- package/dist/cdk/constructs/components/container/container-build-handler.d.ts.map +1 -1
- package/dist/cdk/constructs/components/container/container-build-handler.js +16 -3
- package/dist/cdk/constructs/components/container/container-build-handler.js.map +1 -1
- package/dist/cdk/constructs/components/container/index.d.ts +1 -1
- package/dist/cdk/constructs/components/container/index.d.ts.map +1 -1
- package/dist/cdk/constructs/components/container/index.js +3 -3
- package/dist/cdk/constructs/components/container/index.js.map +1 -1
- package/dist/cdk/constructs/components/gateway/AgentCoreGateway.d.ts +111 -0
- package/dist/cdk/constructs/components/gateway/AgentCoreGateway.d.ts.map +1 -0
- package/dist/cdk/constructs/components/gateway/AgentCoreGateway.js +622 -0
- package/dist/cdk/constructs/components/gateway/AgentCoreGateway.js.map +1 -0
- package/dist/cdk/constructs/components/gateway/connector-defaults.d.ts +20 -0
- package/dist/cdk/constructs/components/gateway/connector-defaults.d.ts.map +1 -0
- package/dist/cdk/constructs/components/gateway/connector-defaults.js +16 -0
- package/dist/cdk/constructs/components/gateway/connector-defaults.js.map +1 -0
- package/dist/cdk/constructs/components/gateway/gateway-targets.d.ts +25 -0
- package/dist/cdk/constructs/components/gateway/gateway-targets.d.ts.map +1 -0
- package/dist/cdk/constructs/components/gateway/gateway-targets.js +95 -0
- package/dist/cdk/constructs/components/gateway/gateway-targets.js.map +1 -0
- package/dist/cdk/constructs/components/gateway/index.d.ts +3 -0
- package/dist/cdk/constructs/components/gateway/index.d.ts.map +1 -0
- package/dist/cdk/constructs/components/gateway/index.js +8 -0
- package/dist/cdk/constructs/components/gateway/index.js.map +1 -0
- package/dist/cdk/constructs/components/index.d.ts +2 -1
- package/dist/cdk/constructs/components/index.d.ts.map +1 -1
- package/dist/cdk/constructs/components/index.js +2 -1
- package/dist/cdk/constructs/components/index.js.map +1 -1
- package/dist/cdk/constructs/components/primitives/capacity-provider/AgentCoreCapacityProvider.d.ts +42 -0
- package/dist/cdk/constructs/components/primitives/capacity-provider/AgentCoreCapacityProvider.d.ts.map +1 -0
- package/dist/cdk/constructs/components/primitives/capacity-provider/AgentCoreCapacityProvider.js +126 -0
- package/dist/cdk/constructs/components/primitives/capacity-provider/AgentCoreCapacityProvider.js.map +1 -0
- package/dist/cdk/constructs/components/primitives/capacity-provider/index.d.ts +2 -0
- package/dist/cdk/constructs/components/primitives/capacity-provider/index.d.ts.map +1 -0
- package/dist/cdk/constructs/components/primitives/capacity-provider/index.js +6 -0
- package/dist/cdk/constructs/components/primitives/capacity-provider/index.js.map +1 -0
- package/dist/cdk/constructs/components/primitives/config-bundle/AgentCoreConfigBundle.d.ts +31 -0
- package/dist/cdk/constructs/components/primitives/config-bundle/AgentCoreConfigBundle.d.ts.map +1 -0
- package/dist/cdk/constructs/components/primitives/config-bundle/AgentCoreConfigBundle.js +62 -0
- package/dist/cdk/constructs/components/primitives/config-bundle/AgentCoreConfigBundle.js.map +1 -0
- package/dist/cdk/constructs/components/primitives/config-bundle/index.d.ts +3 -0
- package/dist/cdk/constructs/components/primitives/config-bundle/index.d.ts.map +1 -0
- package/dist/cdk/constructs/components/primitives/config-bundle/index.js +6 -0
- package/dist/cdk/constructs/components/primitives/config-bundle/index.js.map +1 -0
- package/dist/cdk/constructs/components/primitives/dataset/AgentCoreDataset.d.ts +29 -0
- package/dist/cdk/constructs/components/primitives/dataset/AgentCoreDataset.d.ts.map +1 -0
- package/dist/cdk/constructs/components/primitives/dataset/AgentCoreDataset.js +80 -0
- package/dist/cdk/constructs/components/primitives/dataset/AgentCoreDataset.js.map +1 -0
- package/dist/cdk/constructs/components/primitives/dataset/index.d.ts +2 -0
- package/dist/cdk/constructs/components/primitives/dataset/index.d.ts.map +1 -0
- package/dist/cdk/constructs/components/primitives/dataset/index.js +6 -0
- package/dist/cdk/constructs/components/primitives/dataset/index.js.map +1 -0
- package/dist/cdk/constructs/components/primitives/evaluator/AgentCoreEvaluator.d.ts +27 -5
- package/dist/cdk/constructs/components/primitives/evaluator/AgentCoreEvaluator.d.ts.map +1 -1
- package/dist/cdk/constructs/components/primitives/evaluator/AgentCoreEvaluator.js +129 -40
- package/dist/cdk/constructs/components/primitives/evaluator/AgentCoreEvaluator.js.map +1 -1
- package/dist/cdk/constructs/components/primitives/evaluator/AgentCoreOnlineEvaluationConfig.d.ts +8 -8
- package/dist/cdk/constructs/components/primitives/evaluator/AgentCoreOnlineEvaluationConfig.d.ts.map +1 -1
- package/dist/cdk/constructs/components/primitives/evaluator/AgentCoreOnlineEvaluationConfig.js +98 -124
- package/dist/cdk/constructs/components/primitives/evaluator/AgentCoreOnlineEvaluationConfig.js.map +1 -1
- package/dist/cdk/constructs/components/primitives/harness/AgentCoreHarness.d.ts +124 -0
- package/dist/cdk/constructs/components/primitives/harness/AgentCoreHarness.d.ts.map +1 -0
- package/dist/cdk/constructs/components/primitives/harness/AgentCoreHarness.js +185 -0
- package/dist/cdk/constructs/components/primitives/harness/AgentCoreHarness.js.map +1 -0
- package/dist/cdk/constructs/components/primitives/harness/AgentCoreHarnessRole.d.ts +71 -0
- package/dist/cdk/constructs/components/primitives/harness/AgentCoreHarnessRole.d.ts.map +1 -0
- package/dist/cdk/constructs/components/primitives/harness/AgentCoreHarnessRole.js +389 -0
- package/dist/cdk/constructs/components/primitives/harness/AgentCoreHarnessRole.js.map +1 -0
- package/dist/cdk/constructs/components/primitives/harness/__tests__/AgentCoreHarnessRole.test.d.ts +2 -0
- package/dist/cdk/constructs/components/primitives/harness/__tests__/AgentCoreHarnessRole.test.d.ts.map +1 -0
- package/dist/cdk/constructs/components/primitives/harness/__tests__/AgentCoreHarnessRole.test.js +182 -0
- package/dist/cdk/constructs/components/primitives/harness/__tests__/AgentCoreHarnessRole.test.js.map +1 -0
- package/dist/cdk/constructs/components/primitives/harness/harness-cfn-mapping.d.ts +30 -0
- package/dist/cdk/constructs/components/primitives/harness/harness-cfn-mapping.d.ts.map +1 -0
- package/dist/cdk/constructs/components/primitives/harness/harness-cfn-mapping.js +165 -0
- package/dist/cdk/constructs/components/primitives/harness/harness-cfn-mapping.js.map +1 -0
- package/dist/cdk/constructs/components/primitives/harness/index.d.ts +3 -0
- package/dist/cdk/constructs/components/primitives/harness/index.d.ts.map +1 -0
- package/dist/cdk/constructs/components/primitives/harness/index.js +8 -0
- package/dist/cdk/constructs/components/primitives/harness/index.js.map +1 -0
- package/dist/cdk/constructs/components/primitives/index.d.ts +9 -3
- package/dist/cdk/constructs/components/primitives/index.d.ts.map +1 -1
- package/dist/cdk/constructs/components/primitives/index.js +17 -3
- package/dist/cdk/constructs/components/primitives/index.js.map +1 -1
- package/dist/cdk/constructs/components/primitives/knowledge-base/AgentCoreKnowledgeBase.d.ts +67 -0
- package/dist/cdk/constructs/components/primitives/knowledge-base/AgentCoreKnowledgeBase.d.ts.map +1 -0
- package/dist/cdk/constructs/components/primitives/knowledge-base/AgentCoreKnowledgeBase.js +282 -0
- package/dist/cdk/constructs/components/primitives/knowledge-base/AgentCoreKnowledgeBase.js.map +1 -0
- package/dist/cdk/constructs/components/primitives/knowledge-base/index.d.ts +2 -0
- package/dist/cdk/constructs/components/primitives/knowledge-base/index.d.ts.map +1 -0
- package/dist/cdk/constructs/components/primitives/knowledge-base/index.js +6 -0
- package/dist/cdk/constructs/components/primitives/knowledge-base/index.js.map +1 -0
- package/dist/cdk/constructs/components/primitives/memory/AgentCoreMemory.d.ts +30 -44
- package/dist/cdk/constructs/components/primitives/memory/AgentCoreMemory.d.ts.map +1 -1
- package/dist/cdk/constructs/components/primitives/memory/AgentCoreMemory.js +147 -154
- package/dist/cdk/constructs/components/primitives/memory/AgentCoreMemory.js.map +1 -1
- package/dist/cdk/constructs/components/primitives/memory/index.d.ts +1 -1
- package/dist/cdk/constructs/components/primitives/memory/index.d.ts.map +1 -1
- package/dist/cdk/constructs/components/primitives/memory/index.js.map +1 -1
- package/dist/cdk/constructs/components/primitives/memory/memory-actions.d.ts +17 -0
- package/dist/cdk/constructs/components/primitives/memory/memory-actions.d.ts.map +1 -0
- package/dist/cdk/constructs/components/primitives/memory/memory-actions.js +34 -0
- package/dist/cdk/constructs/components/primitives/memory/memory-actions.js.map +1 -0
- package/dist/cdk/constructs/components/primitives/payment/AgentCorePaymentConnector.d.ts +36 -0
- package/dist/cdk/constructs/components/primitives/payment/AgentCorePaymentConnector.d.ts.map +1 -0
- package/dist/cdk/constructs/components/primitives/payment/AgentCorePaymentConnector.js +52 -0
- package/dist/cdk/constructs/components/primitives/payment/AgentCorePaymentConnector.js.map +1 -0
- package/dist/cdk/constructs/components/primitives/payment/AgentCorePaymentManager.d.ts +65 -0
- package/dist/cdk/constructs/components/primitives/payment/AgentCorePaymentManager.d.ts.map +1 -0
- package/dist/cdk/constructs/components/primitives/payment/AgentCorePaymentManager.js +143 -0
- package/dist/cdk/constructs/components/primitives/payment/AgentCorePaymentManager.js.map +1 -0
- package/dist/cdk/constructs/components/primitives/payment/index.d.ts +3 -0
- package/dist/cdk/constructs/components/primitives/payment/index.d.ts.map +1 -0
- package/dist/cdk/constructs/components/primitives/payment/index.js +8 -0
- package/dist/cdk/constructs/components/primitives/payment/index.js.map +1 -0
- package/dist/cdk/constructs/components/primitives/policy/AgentCorePolicyEngine.d.ts +47 -0
- package/dist/cdk/constructs/components/primitives/policy/AgentCorePolicyEngine.d.ts.map +1 -0
- package/dist/cdk/constructs/components/primitives/policy/AgentCorePolicyEngine.js +94 -0
- package/dist/cdk/constructs/components/primitives/policy/AgentCorePolicyEngine.js.map +1 -0
- package/dist/cdk/constructs/components/primitives/policy/index.d.ts +2 -0
- package/dist/cdk/constructs/components/primitives/policy/index.d.ts.map +1 -0
- package/dist/cdk/constructs/components/primitives/policy/index.js +6 -0
- package/dist/cdk/constructs/components/primitives/policy/index.js.map +1 -0
- package/dist/cdk/constructs/components/primitives/runtime/AgentCoreRuntime.d.ts +110 -9
- package/dist/cdk/constructs/components/primitives/runtime/AgentCoreRuntime.d.ts.map +1 -1
- package/dist/cdk/constructs/components/primitives/runtime/AgentCoreRuntime.js +324 -149
- package/dist/cdk/constructs/components/primitives/runtime/AgentCoreRuntime.js.map +1 -1
- package/dist/cdk/constructs/components/primitives/runtime/index.d.ts +1 -1
- package/dist/cdk/constructs/components/primitives/runtime/index.d.ts.map +1 -1
- package/dist/cdk/constructs/components/primitives/runtime/index.js.map +1 -1
- package/dist/cdk/constructs/components/shared/bindable.d.ts +30 -0
- package/dist/cdk/constructs/components/shared/bindable.d.ts.map +1 -0
- package/dist/cdk/constructs/components/shared/bindable.js +9 -0
- package/dist/cdk/constructs/components/shared/bindable.js.map +1 -0
- package/dist/cdk/constructs/components/shared/environment-variables.d.ts +41 -0
- package/dist/cdk/constructs/components/shared/environment-variables.d.ts.map +1 -0
- package/dist/cdk/constructs/components/shared/environment-variables.js +77 -0
- package/dist/cdk/constructs/components/shared/environment-variables.js.map +1 -0
- package/dist/cdk/constructs/components/shared/execution-role-grants.d.ts +17 -0
- package/dist/cdk/constructs/components/shared/execution-role-grants.d.ts.map +1 -0
- package/dist/cdk/constructs/components/shared/execution-role-grants.js +65 -0
- package/dist/cdk/constructs/components/shared/execution-role-grants.js.map +1 -0
- package/dist/cdk/constructs/components/shared/filesystem-access.d.ts +15 -0
- package/dist/cdk/constructs/components/shared/filesystem-access.d.ts.map +1 -0
- package/dist/cdk/constructs/components/shared/filesystem-access.js +53 -0
- package/dist/cdk/constructs/components/shared/filesystem-access.js.map +1 -0
- package/dist/cdk/constructs/components/shared/identity-access.d.ts +30 -0
- package/dist/cdk/constructs/components/shared/identity-access.d.ts.map +1 -0
- package/dist/cdk/constructs/components/shared/identity-access.js +44 -0
- package/dist/cdk/constructs/components/shared/identity-access.js.map +1 -0
- package/dist/cdk/constructs/components/shared/imported-role-principal.d.ts +32 -0
- package/dist/cdk/constructs/components/shared/imported-role-principal.d.ts.map +1 -0
- package/dist/cdk/constructs/components/shared/imported-role-principal.js +51 -0
- package/dist/cdk/constructs/components/shared/imported-role-principal.js.map +1 -0
- package/dist/cdk/constructs/components/shared/jwt-authorizer.d.ts +10 -0
- package/dist/cdk/constructs/components/shared/jwt-authorizer.d.ts.map +1 -0
- package/dist/cdk/constructs/components/shared/jwt-authorizer.js +20 -0
- package/dist/cdk/constructs/components/shared/jwt-authorizer.js.map +1 -0
- package/dist/cdk/constructs/components/shared/load-additional-policies.d.ts +20 -0
- package/dist/cdk/constructs/components/shared/load-additional-policies.d.ts.map +1 -0
- package/dist/cdk/constructs/components/shared/load-additional-policies.js +47 -0
- package/dist/cdk/constructs/components/shared/load-additional-policies.js.map +1 -0
- package/dist/cdk/constructs/components/shared/managed-tool-access.d.ts +6 -0
- package/dist/cdk/constructs/components/shared/managed-tool-access.d.ts.map +1 -0
- package/dist/cdk/constructs/components/shared/managed-tool-access.js +24 -0
- package/dist/cdk/constructs/components/shared/managed-tool-access.js.map +1 -0
- package/dist/cdk/constructs/components/shared/physical-names.d.ts +17 -0
- package/dist/cdk/constructs/components/shared/physical-names.d.ts.map +1 -0
- package/dist/cdk/constructs/components/shared/physical-names.js +20 -0
- package/dist/cdk/constructs/components/shared/physical-names.js.map +1 -0
- package/dist/cdk/constructs/components/{mcp/McpLambdaCompute.d.ts → tools/LambdaToolTarget.d.ts} +6 -6
- package/dist/cdk/constructs/components/tools/LambdaToolTarget.d.ts.map +1 -0
- package/dist/cdk/constructs/components/{mcp/McpLambdaCompute.js → tools/LambdaToolTarget.js} +20 -12
- package/dist/cdk/constructs/components/tools/LambdaToolTarget.js.map +1 -0
- package/dist/cdk/constructs/components/tools/RuntimeToolTarget.d.ts +28 -0
- package/dist/cdk/constructs/components/tools/RuntimeToolTarget.d.ts.map +1 -0
- package/dist/cdk/constructs/components/{mcp/McpRuntimeCompute.js → tools/RuntimeToolTarget.js} +12 -29
- package/dist/cdk/constructs/components/tools/RuntimeToolTarget.js.map +1 -0
- package/dist/cdk/constructs/components/tools/index.d.ts +3 -0
- package/dist/cdk/constructs/components/tools/index.d.ts.map +1 -0
- package/dist/cdk/constructs/components/tools/index.js +8 -0
- package/dist/cdk/constructs/components/tools/index.js.map +1 -0
- package/dist/cdk/constructs/connections/import-connection.d.ts +10 -0
- package/dist/cdk/constructs/connections/import-connection.d.ts.map +1 -0
- package/dist/cdk/constructs/connections/import-connection.js +64 -0
- package/dist/cdk/constructs/connections/import-connection.js.map +1 -0
- package/dist/cdk/constructs/index.d.ts +9 -3
- package/dist/cdk/constructs/index.d.ts.map +1 -1
- package/dist/cdk/constructs/index.js +23 -3
- package/dist/cdk/constructs/index.js.map +1 -1
- package/dist/cdk/constructs/l3/AgentCoreApplication.d.ts +180 -13
- package/dist/cdk/constructs/l3/AgentCoreApplication.d.ts.map +1 -1
- package/dist/cdk/constructs/l3/AgentCoreApplication.js +703 -39
- package/dist/cdk/constructs/l3/AgentCoreApplication.js.map +1 -1
- package/dist/cdk/constructs/l3/AgentCoreHarnessEnvironment.d.ts +34 -0
- package/dist/cdk/constructs/l3/AgentCoreHarnessEnvironment.d.ts.map +1 -0
- package/dist/cdk/constructs/l3/AgentCoreHarnessEnvironment.js +96 -0
- package/dist/cdk/constructs/l3/AgentCoreHarnessEnvironment.js.map +1 -0
- package/dist/cdk/constructs/l3/AgentCorePayments.d.ts +24 -0
- package/dist/cdk/constructs/l3/AgentCorePayments.d.ts.map +1 -0
- package/dist/cdk/constructs/l3/AgentCorePayments.js +99 -0
- package/dist/cdk/constructs/l3/AgentCorePayments.js.map +1 -0
- package/dist/cdk/constructs/l3/RuntimeEnvironment.d.ts +47 -0
- package/dist/cdk/constructs/l3/RuntimeEnvironment.d.ts.map +1 -0
- package/dist/cdk/constructs/l3/RuntimeEnvironment.js +152 -0
- package/dist/cdk/constructs/l3/RuntimeEnvironment.js.map +1 -0
- package/dist/cdk/constructs/l3/index.d.ts +3 -3
- package/dist/cdk/constructs/l3/index.d.ts.map +1 -1
- package/dist/cdk/constructs/l3/index.js +5 -5
- package/dist/cdk/constructs/l3/index.js.map +1 -1
- package/dist/cdk/index.d.ts +2 -1
- package/dist/cdk/index.d.ts.map +1 -1
- package/dist/cdk/index.js +26 -3
- package/dist/cdk/index.js.map +1 -1
- package/dist/cdk/logical-ids.d.ts +5 -5
- package/dist/cdk/logical-ids.js +5 -5
- package/dist/cdk/project/index.d.ts +4 -0
- package/dist/cdk/project/index.d.ts.map +1 -0
- package/dist/cdk/project/index.js +13 -0
- package/dist/cdk/project/index.js.map +1 -0
- package/dist/cdk/project/read-project.d.ts +32 -0
- package/dist/cdk/project/read-project.d.ts.map +1 -0
- package/dist/cdk/project/read-project.js +86 -0
- package/dist/cdk/project/read-project.js.map +1 -0
- package/dist/cdk/project/target-stacks.d.ts +55 -0
- package/dist/cdk/project/target-stacks.d.ts.map +1 -0
- package/dist/cdk/project/target-stacks.js +50 -0
- package/dist/cdk/project/target-stacks.js.map +1 -0
- package/dist/cdk/project/transform.d.ts +34 -0
- package/dist/cdk/project/transform.d.ts.map +1 -0
- package/dist/cdk/project/transform.js +102 -0
- package/dist/cdk/project/transform.js.map +1 -0
- package/dist/cdk/utils/__tests__/tags.test.d.ts +2 -0
- package/dist/cdk/utils/__tests__/tags.test.d.ts.map +1 -0
- package/dist/cdk/utils/__tests__/tags.test.js +57 -0
- package/dist/cdk/utils/__tests__/tags.test.js.map +1 -0
- package/dist/cdk/utils/tags.d.ts +11 -0
- package/dist/cdk/utils/tags.d.ts.map +1 -0
- package/dist/cdk/utils/tags.js +22 -0
- package/dist/cdk/utils/tags.js.map +1 -0
- package/dist/index.d.ts +3 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +27 -28
- package/dist/index.js.map +1 -1
- package/dist/lib/constants.d.ts +1 -1
- package/dist/lib/constants.d.ts.map +1 -1
- package/dist/lib/constants.js +2 -2
- package/dist/lib/constants.js.map +1 -1
- package/dist/lib/errors/config.d.ts +0 -16
- package/dist/lib/errors/config.d.ts.map +1 -1
- package/dist/lib/errors/config.js +2 -29
- package/dist/lib/errors/config.js.map +1 -1
- package/dist/lib/index.d.ts +1 -2
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +2 -3
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/packaging/helpers.d.ts +19 -0
- package/dist/lib/packaging/helpers.d.ts.map +1 -1
- package/dist/lib/packaging/helpers.js +80 -27
- package/dist/lib/packaging/helpers.js.map +1 -1
- package/dist/lib/packaging/index.d.ts +3 -7
- package/dist/lib/packaging/index.d.ts.map +1 -1
- package/dist/lib/packaging/index.js +14 -11
- package/dist/lib/packaging/index.js.map +1 -1
- package/dist/lib/packaging/node.d.ts +6 -0
- package/dist/lib/packaging/node.d.ts.map +1 -0
- package/dist/lib/packaging/node.js +106 -0
- package/dist/lib/packaging/node.js.map +1 -0
- package/dist/lib/packaging/types/packaging.d.ts +2 -0
- package/dist/lib/packaging/types/packaging.d.ts.map +1 -1
- package/dist/lib/packaging/uv.d.ts.map +1 -1
- package/dist/lib/packaging/uv.js +1 -1
- package/dist/lib/packaging/uv.js.map +1 -1
- package/dist/lib/utils/subprocess.d.ts +5 -1
- package/dist/lib/utils/subprocess.d.ts.map +1 -1
- package/dist/lib/utils/subprocess.js +0 -6
- package/dist/lib/utils/subprocess.js.map +1 -1
- package/dist/schema/constants.d.ts +11 -0
- package/dist/schema/constants.d.ts.map +1 -1
- package/dist/schema/constants.js +33 -6
- package/dist/schema/constants.js.map +1 -1
- package/dist/schema/schemas/agent-env.d.ts +257 -9
- package/dist/schema/schemas/agent-env.d.ts.map +1 -1
- package/dist/schema/schemas/agent-env.js +407 -12
- package/dist/schema/schemas/agent-env.js.map +1 -1
- package/dist/schema/schemas/agentcore-project.d.ts +853 -40
- package/dist/schema/schemas/agentcore-project.d.ts.map +1 -1
- package/dist/schema/schemas/agentcore-project.js +275 -17
- package/dist/schema/schemas/agentcore-project.js.map +1 -1
- package/dist/schema/schemas/auth.d.ts +318 -0
- package/dist/schema/schemas/auth.d.ts.map +1 -0
- package/dist/schema/schemas/auth.js +238 -0
- package/dist/schema/schemas/auth.js.map +1 -0
- package/dist/schema/schemas/aws-targets.d.ts +39 -0
- package/dist/schema/schemas/aws-targets.d.ts.map +1 -1
- package/dist/schema/schemas/aws-targets.js +16 -2
- package/dist/schema/schemas/aws-targets.js.map +1 -1
- package/dist/schema/schemas/connections.d.ts +183 -0
- package/dist/schema/schemas/connections.d.ts.map +1 -0
- package/dist/schema/schemas/connections.js +176 -0
- package/dist/schema/schemas/connections.js.map +1 -0
- package/dist/schema/schemas/deployed-state.d.ts +204 -16
- package/dist/schema/schemas/deployed-state.d.ts.map +1 -1
- package/dist/schema/schemas/deployed-state.js +44 -4
- package/dist/schema/schemas/deployed-state.js.map +1 -1
- package/dist/schema/schemas/index.d.ts +2 -0
- package/dist/schema/schemas/index.d.ts.map +1 -1
- package/dist/schema/schemas/index.js +2 -0
- package/dist/schema/schemas/index.js.map +1 -1
- package/dist/schema/schemas/mcp.d.ts +255 -249
- package/dist/schema/schemas/mcp.d.ts.map +1 -1
- package/dist/schema/schemas/mcp.js +317 -60
- package/dist/schema/schemas/mcp.js.map +1 -1
- package/dist/schema/schemas/primitives/capacity-provider.d.ts +239 -0
- package/dist/schema/schemas/primitives/capacity-provider.d.ts.map +1 -0
- package/dist/schema/schemas/primitives/capacity-provider.js +220 -0
- package/dist/schema/schemas/primitives/capacity-provider.js.map +1 -0
- package/dist/schema/schemas/primitives/config-bundle.d.ts +31 -0
- package/dist/schema/schemas/primitives/config-bundle.d.ts.map +1 -0
- package/dist/schema/schemas/primitives/config-bundle.js +41 -0
- package/dist/schema/schemas/primitives/config-bundle.js.map +1 -0
- package/dist/schema/schemas/primitives/dataset.d.ts +53 -0
- package/dist/schema/schemas/primitives/dataset.d.ts.map +1 -0
- package/dist/schema/schemas/primitives/dataset.js +65 -0
- package/dist/schema/schemas/primitives/dataset.js.map +1 -0
- package/dist/schema/schemas/primitives/evaluator.d.ts +49 -2
- package/dist/schema/schemas/primitives/evaluator.d.ts.map +1 -1
- package/dist/schema/schemas/primitives/evaluator.js +30 -3
- package/dist/schema/schemas/primitives/evaluator.js.map +1 -1
- package/dist/schema/schemas/primitives/harness.d.ts +649 -0
- package/dist/schema/schemas/primitives/harness.d.ts.map +1 -0
- package/dist/schema/schemas/primitives/harness.js +596 -0
- package/dist/schema/schemas/primitives/harness.js.map +1 -0
- package/dist/schema/schemas/primitives/index.d.ts +17 -5
- package/dist/schema/schemas/primitives/index.d.ts.map +1 -1
- package/dist/schema/schemas/primitives/index.js +71 -3
- package/dist/schema/schemas/primitives/index.js.map +1 -1
- package/dist/schema/schemas/primitives/knowledge-base.d.ts +103 -0
- package/dist/schema/schemas/primitives/knowledge-base.d.ts.map +1 -0
- package/dist/schema/schemas/primitives/knowledge-base.js +98 -0
- package/dist/schema/schemas/primitives/knowledge-base.js.map +1 -0
- package/dist/schema/schemas/primitives/memory.d.ts +33 -2
- package/dist/schema/schemas/primitives/memory.d.ts.map +1 -1
- package/dist/schema/schemas/primitives/memory.js +33 -3
- package/dist/schema/schemas/primitives/memory.js.map +1 -1
- package/dist/schema/schemas/primitives/online-evaluation-config.d.ts +22 -3
- package/dist/schema/schemas/primitives/online-evaluation-config.d.ts.map +1 -1
- package/dist/schema/schemas/primitives/online-evaluation-config.js +45 -6
- package/dist/schema/schemas/primitives/online-evaluation-config.js.map +1 -1
- package/dist/schema/schemas/primitives/policy.d.ts +62 -0
- package/dist/schema/schemas/primitives/policy.d.ts.map +1 -0
- package/dist/schema/schemas/primitives/policy.js +64 -0
- package/dist/schema/schemas/primitives/policy.js.map +1 -0
- package/dist/schema/schemas/primitives/tags.d.ts +6 -0
- package/dist/schema/schemas/primitives/tags.d.ts.map +1 -0
- package/dist/schema/schemas/primitives/tags.js +20 -0
- package/dist/schema/schemas/primitives/tags.js.map +1 -0
- package/package.json +13 -11
- package/dist/cdk/constructs/components/container/AgentEcrRepository.d.ts +0 -25
- package/dist/cdk/constructs/components/container/AgentEcrRepository.d.ts.map +0 -1
- package/dist/cdk/constructs/components/container/AgentEcrRepository.js.map +0 -1
- package/dist/cdk/constructs/components/mcp/Gateway.d.ts +0 -55
- package/dist/cdk/constructs/components/mcp/Gateway.d.ts.map +0 -1
- package/dist/cdk/constructs/components/mcp/Gateway.js +0 -454
- package/dist/cdk/constructs/components/mcp/Gateway.js.map +0 -1
- package/dist/cdk/constructs/components/mcp/McpLambdaCompute.d.ts.map +0 -1
- package/dist/cdk/constructs/components/mcp/McpLambdaCompute.js.map +0 -1
- package/dist/cdk/constructs/components/mcp/McpRuntimeCompute.d.ts +0 -36
- package/dist/cdk/constructs/components/mcp/McpRuntimeCompute.d.ts.map +0 -1
- package/dist/cdk/constructs/components/mcp/McpRuntimeCompute.js.map +0 -1
- package/dist/cdk/constructs/components/mcp/index.d.ts +0 -5
- package/dist/cdk/constructs/components/mcp/index.d.ts.map +0 -1
- package/dist/cdk/constructs/components/mcp/index.js +0 -17
- package/dist/cdk/constructs/components/mcp/index.js.map +0 -1
- package/dist/cdk/constructs/components/mcp/mcp-utils.d.ts +0 -25
- package/dist/cdk/constructs/components/mcp/mcp-utils.d.ts.map +0 -1
- package/dist/cdk/constructs/components/mcp/mcp-utils.js +0 -43
- package/dist/cdk/constructs/components/mcp/mcp-utils.js.map +0 -1
- package/dist/cdk/constructs/components/primitives/BasePrimitiveConstruct.d.ts +0 -46
- package/dist/cdk/constructs/components/primitives/BasePrimitiveConstruct.d.ts.map +0 -1
- package/dist/cdk/constructs/components/primitives/BasePrimitiveConstruct.js +0 -49
- package/dist/cdk/constructs/components/primitives/BasePrimitiveConstruct.js.map +0 -1
- package/dist/cdk/constructs/l3/AgentCoreMcp.d.ts +0 -86
- package/dist/cdk/constructs/l3/AgentCoreMcp.d.ts.map +0 -1
- package/dist/cdk/constructs/l3/AgentCoreMcp.js +0 -241
- package/dist/cdk/constructs/l3/AgentCoreMcp.js.map +0 -1
- package/dist/cdk/constructs/l3/AgentEnvironment.d.ts +0 -34
- package/dist/cdk/constructs/l3/AgentEnvironment.d.ts.map +0 -1
- package/dist/cdk/constructs/l3/AgentEnvironment.js +0 -99
- package/dist/cdk/constructs/l3/AgentEnvironment.js.map +0 -1
- package/dist/lib/schemas/io/config-io.d.ts +0 -99
- package/dist/lib/schemas/io/config-io.d.ts.map +0 -1
- package/dist/lib/schemas/io/config-io.js +0 -283
- package/dist/lib/schemas/io/config-io.js.map +0 -1
- package/dist/lib/schemas/io/index.d.ts +0 -3
- package/dist/lib/schemas/io/index.d.ts.map +0 -1
- package/dist/lib/schemas/io/index.js +0 -17
- package/dist/lib/schemas/io/index.js.map +0 -1
- package/dist/lib/schemas/io/path-resolver.d.ts +0 -112
- package/dist/lib/schemas/io/path-resolver.d.ts.map +0 -1
- package/dist/lib/schemas/io/path-resolver.js +0 -195
- package/dist/lib/schemas/io/path-resolver.js.map +0 -1
package/README.md
CHANGED
|
@@ -17,69 +17,296 @@ npm install @aws/agentcore-cdk aws-cdk-lib constructs
|
|
|
17
17
|
|
|
18
18
|
## Quick Start
|
|
19
19
|
|
|
20
|
+
An AgentCore project is a directory with an `agentcore/agentcore.json` (written by `agentcore project create`). The CDK
|
|
21
|
+
app the AgentCore CLI vends into `agentcore/cdk/` is the smallest complete use of this library — three calls in
|
|
22
|
+
`bin/cdk.ts` and one construct in `lib/cdk-stack.ts`:
|
|
23
|
+
|
|
20
24
|
```typescript
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
import {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
25
|
+
// bin/cdk.ts
|
|
26
|
+
#!/usr/bin/env node
|
|
27
|
+
import { App } from 'aws-cdk-lib';
|
|
28
|
+
import { readAgentCoreProject, resolveTargetStacks, transformAgentCoreJson } from '@aws/agentcore-cdk';
|
|
29
|
+
import { AgentCoreStack } from '../lib/cdk-stack';
|
|
30
|
+
|
|
31
|
+
try {
|
|
32
|
+
// The AgentCore CLI runs this app from agentcore/cdk/; readAgentCoreProject walks up to agentcore/.
|
|
33
|
+
const project = readAgentCoreProject();
|
|
34
|
+
const app = new App();
|
|
35
|
+
for (const stack of resolveTargetStacks({
|
|
36
|
+
projectName: project.projectName,
|
|
37
|
+
targets: project.targets,
|
|
38
|
+
deployedState: project.deployedState,
|
|
39
|
+
})) {
|
|
40
|
+
new AgentCoreStack(app, stack.stackName, {
|
|
41
|
+
env: stack.env,
|
|
42
|
+
tags: stack.tags,
|
|
43
|
+
description: stack.description,
|
|
44
|
+
application: transformAgentCoreJson(project.agentCoreJson, {
|
|
45
|
+
projectRoot: project.projectRoot,
|
|
46
|
+
credentials: stack.credentials,
|
|
47
|
+
target: stack.target,
|
|
48
|
+
}),
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
app.synth();
|
|
52
|
+
} catch (error) {
|
|
53
|
+
console.error('AgentCore CDK synthesis failed:', error instanceof Error ? error.message : error);
|
|
54
|
+
process.exit(1);
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
// lib/cdk-stack.ts
|
|
60
|
+
import { AgentCoreApplication, type AgentCoreApplicationProps } from '@aws/agentcore-cdk';
|
|
61
|
+
import { Stack, type StackProps } from 'aws-cdk-lib';
|
|
62
|
+
import { Construct } from 'constructs';
|
|
63
|
+
|
|
64
|
+
export interface AgentCoreStackProps extends StackProps {
|
|
65
|
+
/** Props for the AgentCore application, produced by transformAgentCoreJson from agentcore/agentcore.json. */
|
|
66
|
+
application: AgentCoreApplicationProps;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* The stack the AgentCore CLI deploys. Everything declared in agentcore/agentcore.json is
|
|
71
|
+
* created by the AgentCoreApplication construct. Add your own resources below it and wire
|
|
72
|
+
* them to your runtimes and harnesses through the application's accessors.
|
|
73
|
+
*/
|
|
74
|
+
export class AgentCoreStack extends Stack {
|
|
75
|
+
public readonly application: AgentCoreApplication;
|
|
76
|
+
|
|
77
|
+
constructor(scope: Construct, id: string, props: AgentCoreStackProps) {
|
|
78
|
+
super(scope, id, props);
|
|
79
|
+
this.application = new AgentCoreApplication(this, 'Application', props.application);
|
|
80
|
+
|
|
81
|
+
// Example: give a runtime a DynamoDB table.
|
|
82
|
+
//
|
|
83
|
+
// import * as dynamodb from 'aws-cdk-lib/aws-dynamodb';
|
|
84
|
+
// const orders = new dynamodb.Table(this, 'Orders', {
|
|
85
|
+
// partitionKey: { name: 'pk', type: dynamodb.AttributeType.STRING },
|
|
86
|
+
// });
|
|
87
|
+
// const checkout = this.application.runtime('checkout'); // or .harness('support')
|
|
88
|
+
// checkout.grantReadWrite(orders);
|
|
89
|
+
// checkout.addEnvironmentVariable('ORDERS_TABLE', orders.tableName);
|
|
46
90
|
}
|
|
47
91
|
}
|
|
48
92
|
```
|
|
49
93
|
|
|
94
|
+
The three entry points:
|
|
95
|
+
|
|
96
|
+
| Function | What it does |
|
|
97
|
+
| ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
98
|
+
| `readAgentCoreProject(startDir = process.cwd())` | Walks up to the nearest `agentcore/agentcore.json` and reads the project files once: the parsed `agentcore.json`, the validated project name, `aws-targets.json` (`[]` when absent) and `agentcore/.cli/deployed-state.json` (`undefined` when absent, a malformed file throws). The only place the app touches the working directory. |
|
|
99
|
+
| `resolveTargetStacks({ projectName, targets, deployedState })` | One `TargetStack` per deployment target, `AgentCore-<project>-<target>`, pinned to the target's account/region, tagged `agentcore:project-name` and `agentcore:target-name`, with that target's credential providers, or one environment-agnostic `AgentCore-<project>` stack (project tag only) when there are no targets yet. |
|
|
100
|
+
| `transformAgentCoreJson(agentCoreJson, { projectRoot, credentials, target })` | Validates `agentcore.json`, reads each harness's `harness.yaml` and `system-prompt.md` and every non-S3 knowledge-base connector file under `projectRoot`, and returns the `AgentCoreApplicationProps` for one `AgentCoreApplication`. `target` is the stack's deployment target, whose name becomes `AgentCoreApplicationProps.targetName`. Synchronous, deterministic, no network, no `process.env`. |
|
|
101
|
+
|
|
102
|
+
Every relative path in the spec resolves against `projectRoot`, so synthesis never depends on the working directory.
|
|
103
|
+
|
|
104
|
+
Every physical AWS resource name is `<project><sep><target><sep><name>`: the project name, the deployment target name
|
|
105
|
+
and the resource's spec name, joined by the separator the service accepts (`_` for AgentCore resources other than
|
|
106
|
+
gateways and for knowledge bases, `-` for gateways and Lambda functions, `/` for ECR repositories, which are also
|
|
107
|
+
lowercased). Project and target names are letters and digits, so the separators always delimit the three segments and
|
|
108
|
+
two targets can never compose the same name. The target reaches the constructs through `transformAgentCoreJson`'s
|
|
109
|
+
`target` option, which sets `AgentCoreApplicationProps.targetName`, and the vended `bin/cdk.ts` passes
|
|
110
|
+
`target: stack.target`, so runtime `checkout` of project `Shop` deployed to target `prodEu` is `Shop_prodEu_checkout`.
|
|
111
|
+
Without a target (the `project build` stack, or `AgentCoreApplication` used without `targetName`) the name is
|
|
112
|
+
`<project><sep><name>`. A composed name longer than the service's limit fails at synth, naming the resource, its length
|
|
113
|
+
and the limit.
|
|
114
|
+
|
|
50
115
|
## Constructs
|
|
51
116
|
|
|
52
117
|
### AgentCoreApplication
|
|
53
118
|
|
|
54
|
-
Main L3 construct for deploying agent environments.
|
|
119
|
+
Main L3 construct for deploying agent environments. It takes the project spec (`agentcore.json`), the harness
|
|
120
|
+
configurations, the deployed credentials, an optional `targetName` (the deployment target, the middle segment of every
|
|
121
|
+
physical resource name) and a required `projectRoot` (the directory that contains `agentcore/`; every relative path in
|
|
122
|
+
the spec resolves against it, so synthesis never depends on the working directory).
|
|
123
|
+
|
|
124
|
+
The application creates everything `agentcore.json` declares, so one construct owns the whole spec. Gateways
|
|
125
|
+
(`Gateway<name>`), the compute behind their targets (`LambdaToolTarget<name>`, `RuntimeToolTarget<name>`) and standalone
|
|
126
|
+
tool runtimes (`ToolRuntime<name>`) are direct children of the application. Payment managers and connectors are created
|
|
127
|
+
under the `Payments` child at stack scope, with the construct ids the AgentCore CLI's original template used
|
|
128
|
+
(`Payment<manager>` and `Payment<manager><connector>`, underscores removed), so a stack that template deployed keeps its
|
|
129
|
+
resources. Those ids must not change.
|
|
130
|
+
|
|
131
|
+
Once every resource exists the application binds each one to the workloads that use it (see
|
|
132
|
+
[Binding AgentCore resources](#binding-agentcore-resources)): every memory and gateway to every runtime, payment
|
|
133
|
+
managers to Python HTTP runtimes, each harness's referenced memory and every gateway to that harness, and each
|
|
134
|
+
`connections[]` entry and tool runtime binding to the workload that names it.
|
|
135
|
+
|
|
136
|
+
### RuntimeEnvironment
|
|
137
|
+
|
|
138
|
+
One entry of `runtimes[]`: the `AgentCoreRuntime`, its build resources, its endpoints and its outputs.
|
|
139
|
+
|
|
140
|
+
## Extending the application
|
|
141
|
+
|
|
142
|
+
### Get resources
|
|
143
|
+
|
|
144
|
+
Use a getter when the resource must exist. A typo or missing resource fails at synth and lists the available names:
|
|
55
145
|
|
|
56
|
-
|
|
146
|
+
```typescript
|
|
147
|
+
const checkout = this.application.runtime('checkout');
|
|
148
|
+
const support = this.application.harness('support');
|
|
149
|
+
const tools = this.application.gateway('tools');
|
|
150
|
+
const history = this.application.memory('history');
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Other getters are `knowledgeBase(name)`, `evaluator(name)`, `onlineEvalConfig(name)`, `policyEngine(name)`,
|
|
154
|
+
`configBundle(name)`, `capacityProvider(name)`, `toolRuntime(name)`, `paymentManager(name)` and
|
|
155
|
+
`paymentConnector(manager, connector)`. Use the corresponding typed map, such as `memories.get(name)`, when a resource
|
|
156
|
+
is optional or when iterating. `runtimeEnvironments`, `harnessRoles` and `toolLambdaFunctions` are map-only. A legacy
|
|
157
|
+
role-only harness is available through `harnessRoles`; `harness(name)` returns only a fully synthesized harness.
|
|
158
|
+
|
|
159
|
+
### Grant permissions
|
|
57
160
|
|
|
58
|
-
|
|
161
|
+
The constructs that own an execution role (`AgentCoreRuntime`, `AgentCoreHarness`, `AgentCoreHarnessRole` and
|
|
162
|
+
`AgentCoreGateway`) implement `iam.IGrantable`, so any AWS L2 grant accepts them. Runtimes and harnesses also expose
|
|
163
|
+
`grantRead` / `grantWrite` / `grantReadWrite` for DynamoDB tables, S3 buckets and Secrets Manager secrets (each
|
|
164
|
+
delegates to the resource's own grant method, so the IAM actions stay owned by aws-cdk-lib),
|
|
165
|
+
`grant(actions, resources)`, `addToPolicy` / `addToRolePolicy`, and `addEnvironmentVariable`:
|
|
59
166
|
|
|
60
|
-
|
|
167
|
+
```typescript
|
|
168
|
+
import * as dynamodb from 'aws-cdk-lib/aws-dynamodb';
|
|
169
|
+
import * as s3 from 'aws-cdk-lib/aws-s3';
|
|
170
|
+
import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager';
|
|
171
|
+
|
|
172
|
+
const orders = new dynamodb.Table(this, 'Orders', {
|
|
173
|
+
partitionKey: { name: 'pk', type: dynamodb.AttributeType.STRING },
|
|
174
|
+
});
|
|
175
|
+
const checkout = this.application.runtime('checkout');
|
|
176
|
+
checkout.grantReadWrite(orders); // updates the runtime's execution role
|
|
177
|
+
checkout.addEnvironmentVariable('ORDERS_TABLE', orders.tableName);
|
|
178
|
+
orders.grantReadData(this.application.harness('support')); // any AWS L2 grant works too
|
|
61
179
|
|
|
62
|
-
|
|
180
|
+
const reports = new s3.Bucket(this, 'Reports');
|
|
181
|
+
checkout.grantWrite(reports, 'checkout/*'); // s3:PutObject + s3:DeleteObject* on checkout/* only
|
|
182
|
+
|
|
183
|
+
const apiKey = new secretsmanager.Secret(this, 'PartnerApiKey');
|
|
184
|
+
checkout.grantRead(apiKey); // secrets are read-only for a workload; grantWrite(secret) throws
|
|
185
|
+
checkout.addEnvironmentVariable('PARTNER_API_KEY_ARN', apiKey.secretArn);
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
AgentCore resources also provide grants for their own data-plane operations: runtimes have `grantInvoke`, `grantExec`
|
|
189
|
+
and `grantInvokeAll`; harnesses and gateways have `grantInvoke`; memories have `grant` and `grantWithAccess`; payment
|
|
190
|
+
managers have `grantProcessPayment`. Use these when the caller already knows how to find the resource:
|
|
191
|
+
|
|
192
|
+
```typescript
|
|
193
|
+
const support = this.application.harness('support');
|
|
194
|
+
|
|
195
|
+
this.application.runtime('search').grantInvoke(support);
|
|
196
|
+
this.application.memory('history').grantWithAccess(support, 'read');
|
|
197
|
+
this.application.gateway('tools').grantInvoke(support);
|
|
198
|
+
this.application.paymentManager('billing').grantProcessPayment(support);
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
**Imported roles.** A runtime, harness or gateway configured with an `executionRoleArn` uses a role CDK cannot modify.
|
|
202
|
+
Every grant path — the conveniences, `grant`, `addToPolicy`, and any L2 grant made through `grantPrincipal` — emits a
|
|
203
|
+
synth-time warning listing the actions that were **not** attached; the imported role must already carry them.
|
|
204
|
+
|
|
205
|
+
**Environment variable limits.** Both resources accept at most 50 variables; keys must match `^[a-zA-Z_][a-zA-Z0-9_]*$`
|
|
206
|
+
and be 1–100 characters; values may be at most 2048 characters. `addEnvironmentVariable` validates at call time and
|
|
207
|
+
names the construct, the key and the limit; setting a key to the value it already has is a no-op, setting it to a
|
|
208
|
+
different value is an error.
|
|
209
|
+
|
|
210
|
+
### Binding AgentCore resources
|
|
211
|
+
|
|
212
|
+
`AgentCoreMemory`, `AgentCoreGateway`, `AgentCorePaymentManager` and `AgentCoreRuntime` implement `IBindable`.
|
|
213
|
+
`bind(workload)` grants the workload's execution role the resource's data-plane access through the resource's own grant
|
|
214
|
+
method and sets the variables the workload's code reads to find it, all under the resource's `discoveryPrefix`
|
|
215
|
+
(`AGENTCORE_<TYPE>_<NAME>`, the name uppercased with every other character replaced by `_`). Runtimes and harnesses are
|
|
216
|
+
the workloads (`IAgentCoreWorkload`). Use `grant*` when only IAM permission is needed; use `bind` when the workload also
|
|
217
|
+
needs discovery environment variables.
|
|
218
|
+
|
|
219
|
+
The application binds the relationships declared in `agentcore.json`. A stack extending the application can bind
|
|
220
|
+
additional relationships or resources imported by ARN:
|
|
221
|
+
|
|
222
|
+
```typescript
|
|
223
|
+
import { AgentCoreMemory } from '@aws/agentcore-cdk';
|
|
224
|
+
|
|
225
|
+
const checkout = this.application.runtime('checkout');
|
|
226
|
+
const shared = AgentCoreMemory.fromMemoryArn(
|
|
227
|
+
this,
|
|
228
|
+
'shared',
|
|
229
|
+
'arn:aws:bedrock-agentcore:us-west-2:123456789012:memory/x'
|
|
230
|
+
);
|
|
231
|
+
shared.bind(checkout, { access: 'read' }); // AGENTCORE_MEMORY_SHARED_ID and _ARN, read actions on the ARN
|
|
232
|
+
|
|
233
|
+
const support = this.application.harness('support');
|
|
234
|
+
this.application.toolRuntime('search').bind(support, { envVarName: 'SEARCH_TOOL_ARN', exec: true });
|
|
235
|
+
this.application.paymentManager('billing').bind(support);
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
| Resource | `NAME` | Variables |
|
|
239
|
+
| --------------------------------------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
240
|
+
| Memory | spec name, or the import id | `ID`, `ARN` |
|
|
241
|
+
| Gateway | spec name, or the import id | `URL`, `ARN`, `AUTH_TYPE` (`AWS_IAM`, `CUSTOM_JWT`, `NONE`), `CREDENTIAL_PROVIDER` for `CUSTOM_JWT` |
|
|
242
|
+
| Payment manager | spec name | `MANAGER_ARN`, `PROCESS_PAYMENT_ROLE_ARN`, `CONNECTOR_ID` (first connector), `AUTO_PAYMENT`, `TOOL_ALLOWLIST`, `NETWORK_PREFERENCES`, `AUTH_MODE` |
|
|
243
|
+
| Runtime (as a tool) | runtime name, or the import id | `ARN`, or the binding's `envVarName` verbatim |
|
|
244
|
+
| Browser, code interpreter (connections) | connection id | `ID` when an ARN is given, nothing for the AWS default |
|
|
245
|
+
| Credential | credential name | `NAME`, the provisioned provider name (from the recorded ARN) |
|
|
246
|
+
|
|
247
|
+
The import id of a `connections[]` entry is `connectionTokenFor(connection)`: the connection `id`, or
|
|
248
|
+
`<type>-<resource id>` when there is none, uppercased with every other character replaced by `_`, the same token the
|
|
249
|
+
AgentCore CLI bakes into generated code. Binding the same resource to a workload twice is a no-op. Two resources that
|
|
250
|
+
share a prefix and set a variable to different values fail at synth naming the workload and the variable.
|
|
251
|
+
|
|
252
|
+
### Container builds in a VPC
|
|
253
|
+
|
|
254
|
+
When a Container-build agent (or harness) sets `networkMode: VPC`, the build infrastructure — the orchestrator Lambda
|
|
255
|
+
and the shared CodeBuild project — is placed in the same VPC as the runtime, using `networkConfig.subnets` and
|
|
256
|
+
`networkConfig.securityGroups`. CodeBuild additionally requires `networkConfig.vpcId` (its API cannot infer the VPC from
|
|
257
|
+
subnets); it is required only for Container builds in VPC mode.
|
|
258
|
+
|
|
259
|
+
All Container agents and harnesses in a single project must build in the same VPC — the CodeBuild project is shared per
|
|
260
|
+
stack and synthesis fails fast on a mismatch. Container builds in VPC mode allow at most 5 security groups (a CodeBuild
|
|
261
|
+
limit), vs 16 for the runtime.
|
|
262
|
+
|
|
263
|
+
**Network prerequisites.** Private subnets must be able to reach the services the build uses, or the build will hang
|
|
264
|
+
until timeout:
|
|
265
|
+
|
|
266
|
+
- The build Lambda calls CodeBuild (`StartBuild`/`BatchGetBuilds`) and must reach the CloudFormation response endpoint
|
|
267
|
+
(S3).
|
|
268
|
+
- CodeBuild must reach ECR (api + dkr), S3 (source asset), CloudWatch Logs, STS, and any registry the Dockerfile pulls
|
|
269
|
+
base images from.
|
|
270
|
+
|
|
271
|
+
Provide a NAT gateway or VPC endpoints for: ECR (api, dkr), S3 (gateway), CloudWatch Logs, CodeBuild, and STS — plus
|
|
272
|
+
egress for public base-image pulls.
|
|
63
273
|
|
|
64
274
|
## Standalone Usage
|
|
65
275
|
|
|
66
|
-
These constructs can be used independently without the CLI:
|
|
276
|
+
These constructs can be used independently without the CLI. Build the props from a project directory:
|
|
67
277
|
|
|
68
278
|
```typescript
|
|
69
|
-
import { AgentCoreApplication,
|
|
279
|
+
import { AgentCoreApplication, readAgentCoreProject, transformAgentCoreJson } from '@aws/agentcore-cdk';
|
|
280
|
+
|
|
281
|
+
const project = readAgentCoreProject('/path/to/my-project');
|
|
282
|
+
new AgentCoreApplication(
|
|
283
|
+
this,
|
|
284
|
+
'App',
|
|
285
|
+
transformAgentCoreJson(project.agentCoreJson, { projectRoot: project.projectRoot })
|
|
286
|
+
);
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
or pass a spec directly with the required project root that the spec's relative paths resolve against:
|
|
290
|
+
|
|
291
|
+
```typescript
|
|
292
|
+
import { AgentCoreApplication } from '@aws/agentcore-cdk';
|
|
70
293
|
|
|
71
|
-
// Option 1: Pass spec directly
|
|
72
294
|
new AgentCoreApplication(this, 'App', {
|
|
73
295
|
spec: {
|
|
74
|
-
name: '
|
|
75
|
-
|
|
296
|
+
name: 'myProject',
|
|
297
|
+
version: 2,
|
|
298
|
+
runtimes: [
|
|
299
|
+
{
|
|
300
|
+
name: 'myAgent',
|
|
301
|
+
build: 'CodeZip',
|
|
302
|
+
entrypoint: 'main.py',
|
|
303
|
+
codeLocation: 'app/myAgent/',
|
|
304
|
+
runtimeVersion: 'PYTHON_3_12',
|
|
305
|
+
},
|
|
306
|
+
],
|
|
76
307
|
},
|
|
308
|
+
projectRoot: '/path/to/my-project',
|
|
77
309
|
});
|
|
78
|
-
|
|
79
|
-
// Option 2: Read from disk (using built-in ConfigIO)
|
|
80
|
-
const configIO = new ConfigIO({ baseDir: './agentcore' });
|
|
81
|
-
const spec = await configIO.readProjectSpec();
|
|
82
|
-
new AgentCoreApplication(this, 'App', { spec });
|
|
83
310
|
```
|
|
84
311
|
|
|
85
312
|
## Related Package
|
package/dist/cdk/constants.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare const AGENTCORE_SERVICE_PRINCIPAL = "bedrock-agentcore.amazonaws.com";
|
|
2
2
|
export declare const LAMBDA_SERVICE_PRINCIPAL = "lambda.amazonaws.com";
|
|
3
|
+
export declare const MAX_LAMBDA_FUNCTION_NAME_LENGTH = 64;
|
|
3
4
|
export declare const BUILTIN_EVALUATOR_PREFIX = "Builtin.";
|
|
4
5
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/cdk/constants.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,2BAA2B,oCAAoC,CAAC;AAC7E,eAAO,MAAM,wBAAwB,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/cdk/constants.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,2BAA2B,oCAAoC,CAAC;AAC7E,eAAO,MAAM,wBAAwB,yBAAyB,CAAC;AAC/D,eAAO,MAAM,+BAA+B,KAAK,CAAC;AAMlD,eAAO,MAAM,wBAAwB,aAAa,CAAC"}
|
package/dist/cdk/constants.js
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
// Service Principals
|
|
4
4
|
// ============================================================================
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.BUILTIN_EVALUATOR_PREFIX = exports.LAMBDA_SERVICE_PRINCIPAL = exports.AGENTCORE_SERVICE_PRINCIPAL = void 0;
|
|
6
|
+
exports.BUILTIN_EVALUATOR_PREFIX = exports.MAX_LAMBDA_FUNCTION_NAME_LENGTH = exports.LAMBDA_SERVICE_PRINCIPAL = exports.AGENTCORE_SERVICE_PRINCIPAL = void 0;
|
|
7
7
|
exports.AGENTCORE_SERVICE_PRINCIPAL = 'bedrock-agentcore.amazonaws.com';
|
|
8
8
|
exports.LAMBDA_SERVICE_PRINCIPAL = 'lambda.amazonaws.com';
|
|
9
|
+
exports.MAX_LAMBDA_FUNCTION_NAME_LENGTH = 64;
|
|
9
10
|
// ============================================================================
|
|
10
11
|
// Evaluator Constants
|
|
11
12
|
// ============================================================================
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/cdk/constants.ts"],"names":[],"mappings":";AAAA,+EAA+E;AAC/E,qBAAqB;AACrB,+EAA+E;;;AAElE,QAAA,2BAA2B,GAAG,iCAAiC,CAAC;AAChE,QAAA,wBAAwB,GAAG,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/cdk/constants.ts"],"names":[],"mappings":";AAAA,+EAA+E;AAC/E,qBAAqB;AACrB,+EAA+E;;;AAElE,QAAA,2BAA2B,GAAG,iCAAiC,CAAC;AAChE,QAAA,wBAAwB,GAAG,sBAAsB,CAAC;AAClD,QAAA,+BAA+B,GAAG,EAAE,CAAC;AAElD,+EAA+E;AAC/E,sBAAsB;AACtB,+EAA+E;AAElE,QAAA,wBAAwB,GAAG,UAAU,CAAC"}
|
|
@@ -6,13 +6,35 @@ export interface ContainerSourceAssetProps {
|
|
|
6
6
|
* The agent configuration containing code location details.
|
|
7
7
|
*/
|
|
8
8
|
readonly config: AgentEnvSpec;
|
|
9
|
+
/**
|
|
10
|
+
* Absolute path of the `agentcore/` config directory. The build context (`buildContextPath`
|
|
11
|
+
* or `codeLocation`) resolves against its parent, the project root.
|
|
12
|
+
*/
|
|
13
|
+
readonly configRoot: string;
|
|
9
14
|
}
|
|
10
15
|
/**
|
|
11
|
-
* Packages the
|
|
16
|
+
* Packages the Docker build context (including the Dockerfile) as an S3 asset for CodeBuild.
|
|
17
|
+
*
|
|
18
|
+
* The uploaded directory is `buildContextPath` when set, otherwise `codeLocation`. It becomes both
|
|
19
|
+
* the `docker build` context (the `.` in the buildspec) and the root the Dockerfile path is resolved
|
|
20
|
+
* against, so a shared Dockerfile in a monorepo can COPY files that live outside the agent's own
|
|
21
|
+
* `codeLocation`.
|
|
22
|
+
*
|
|
23
|
+
* The uploaded context's `exclude` list (evaluated with `IgnoreMode.DOCKER`, last match wins) layers:
|
|
24
|
+
* 1. {@link CONTAINER_CONTEXT_SECRET_EXCLUDES} — an unconditional secret/junk baseline applied to
|
|
25
|
+
* BOTH `codeLocation` and `buildContextPath` builds, so a stray `.env` / `.git` / `node_modules`
|
|
26
|
+
* is never persisted to the assets bucket or baked into the image (mirrors the CodeZip guard);
|
|
27
|
+
* 2. the user's own build-context-root `.dockerignore`, so they can exclude more or re-include a
|
|
28
|
+
* baseline path with a `!pattern` line;
|
|
29
|
+
* 3. {@link forceKeepDockerfilePatterns} — a force-keep of the Dockerfile (+ ancestor dirs) so an
|
|
30
|
+
* allowlist-style `.dockerignore` can't drop the file CodeBuild builds with.
|
|
31
|
+
*
|
|
32
|
+
* NOTE: applying the baseline unconditionally changes the asset hash for pre-existing container stacks
|
|
33
|
+
* (which previously uploaded the raw directory), so the first deploy after upgrade re-uploads the
|
|
34
|
+
* context and rebuilds the image once. This is intentional — it is what closes the secret-leak.
|
|
12
35
|
*
|
|
13
|
-
* Unlike BundledCodeZipAsset which packages code into a zip with dependencies,
|
|
14
|
-
*
|
|
15
|
-
* within the source to build the container image.
|
|
36
|
+
* Unlike BundledCodeZipAsset which packages code into a zip with dependencies, this uploads the
|
|
37
|
+
* directory as-is; CodeBuild uses the Dockerfile within it to build the container image.
|
|
16
38
|
*/
|
|
17
39
|
export declare class ContainerSourceAsset extends Construct {
|
|
18
40
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContainerSourceAsset.d.ts","sourceRoot":"","sources":["../../../../../src/cdk/constructs/bundling/container/ContainerSourceAsset.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"ContainerSourceAsset.d.ts","sourceRoot":"","sources":["../../../../../src/cdk/constructs/bundling/container/ContainerSourceAsset.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAIvC,MAAM,WAAW,yBAAyB;IACxC;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAE9B;;;OAGG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAsCD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,oBAAqB,SAAQ,SAAS;IACjD;;OAEG;IACH,SAAgB,KAAK,EAAE,KAAK,CAAC;gBAEjB,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,yBAAyB;CAmB3E"}
|
|
@@ -2,14 +2,68 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ContainerSourceAsset = void 0;
|
|
4
4
|
const lib_1 = require("../../../../lib");
|
|
5
|
+
const aws_cdk_lib_1 = require("aws-cdk-lib");
|
|
5
6
|
const aws_s3_assets_1 = require("aws-cdk-lib/aws-s3-assets");
|
|
6
7
|
const constructs_1 = require("constructs");
|
|
8
|
+
const fs_1 = require("fs");
|
|
9
|
+
const path_1 = require("path");
|
|
7
10
|
/**
|
|
8
|
-
*
|
|
11
|
+
* Read the `.dockerignore` at the build-context root and return its patterns (comments and blank
|
|
12
|
+
* lines stripped). Paired with `IgnoreMode.DOCKER` on the `Asset`, this makes the uploaded deploy
|
|
13
|
+
* context honor exactly what a local `docker build` from the same context would — the CDK `Asset`
|
|
14
|
+
* does not read `.dockerignore` on its own. Returns `[]` when there is no `.dockerignore`.
|
|
15
|
+
*/
|
|
16
|
+
function readDockerignorePatterns(contextRoot) {
|
|
17
|
+
const dockerignorePath = (0, path_1.join)(contextRoot, '.dockerignore');
|
|
18
|
+
if (!(0, fs_1.existsSync)(dockerignorePath)) {
|
|
19
|
+
return [];
|
|
20
|
+
}
|
|
21
|
+
return (0, fs_1.readFileSync)(dockerignorePath, 'utf-8')
|
|
22
|
+
.split(/\r?\n/)
|
|
23
|
+
.map(line => line.trim())
|
|
24
|
+
.filter(line => line.length > 0 && !line.startsWith('#'));
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Force-keep the Dockerfile (and each of its ancestor directories) so an allowlist-style
|
|
28
|
+
* `.dockerignore` (`*` then `!keep`) — or any baseline/user pattern — can never drop the very file
|
|
29
|
+
* CodeBuild builds with (`-f`). Docker will not re-include a file whose parent directory is excluded,
|
|
30
|
+
* so each ancestor segment is negated too. Emitted last; in Docker semantics the last matching pattern
|
|
31
|
+
* wins, so these negations override any preceding exclude.
|
|
32
|
+
*/
|
|
33
|
+
function forceKeepDockerfilePatterns(dockerfileRelPath) {
|
|
34
|
+
const segments = dockerfileRelPath.split('/').filter(segment => segment.length > 0);
|
|
35
|
+
const patterns = [];
|
|
36
|
+
for (let i = 1; i < segments.length; i++) {
|
|
37
|
+
patterns.push(`!${segments.slice(0, i).join('/')}`);
|
|
38
|
+
}
|
|
39
|
+
if (segments.length > 0) {
|
|
40
|
+
patterns.push(`!${segments.join('/')}`);
|
|
41
|
+
}
|
|
42
|
+
return patterns;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Packages the Docker build context (including the Dockerfile) as an S3 asset for CodeBuild.
|
|
46
|
+
*
|
|
47
|
+
* The uploaded directory is `buildContextPath` when set, otherwise `codeLocation`. It becomes both
|
|
48
|
+
* the `docker build` context (the `.` in the buildspec) and the root the Dockerfile path is resolved
|
|
49
|
+
* against, so a shared Dockerfile in a monorepo can COPY files that live outside the agent's own
|
|
50
|
+
* `codeLocation`.
|
|
51
|
+
*
|
|
52
|
+
* The uploaded context's `exclude` list (evaluated with `IgnoreMode.DOCKER`, last match wins) layers:
|
|
53
|
+
* 1. {@link CONTAINER_CONTEXT_SECRET_EXCLUDES} — an unconditional secret/junk baseline applied to
|
|
54
|
+
* BOTH `codeLocation` and `buildContextPath` builds, so a stray `.env` / `.git` / `node_modules`
|
|
55
|
+
* is never persisted to the assets bucket or baked into the image (mirrors the CodeZip guard);
|
|
56
|
+
* 2. the user's own build-context-root `.dockerignore`, so they can exclude more or re-include a
|
|
57
|
+
* baseline path with a `!pattern` line;
|
|
58
|
+
* 3. {@link forceKeepDockerfilePatterns} — a force-keep of the Dockerfile (+ ancestor dirs) so an
|
|
59
|
+
* allowlist-style `.dockerignore` can't drop the file CodeBuild builds with.
|
|
60
|
+
*
|
|
61
|
+
* NOTE: applying the baseline unconditionally changes the asset hash for pre-existing container stacks
|
|
62
|
+
* (which previously uploaded the raw directory), so the first deploy after upgrade re-uploads the
|
|
63
|
+
* context and rebuilds the image once. This is intentional — it is what closes the secret-leak.
|
|
9
64
|
*
|
|
10
|
-
* Unlike BundledCodeZipAsset which packages code into a zip with dependencies,
|
|
11
|
-
*
|
|
12
|
-
* within the source to build the container image.
|
|
65
|
+
* Unlike BundledCodeZipAsset which packages code into a zip with dependencies, this uploads the
|
|
66
|
+
* directory as-is; CodeBuild uses the Dockerfile within it to build the container image.
|
|
13
67
|
*/
|
|
14
68
|
class ContainerSourceAsset extends constructs_1.Construct {
|
|
15
69
|
/**
|
|
@@ -18,13 +72,18 @@ class ContainerSourceAsset extends constructs_1.Construct {
|
|
|
18
72
|
asset;
|
|
19
73
|
constructor(scope, id, props) {
|
|
20
74
|
super(scope, id);
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
75
|
+
const buildContext = props.config.buildContextPath ?? props.config.codeLocation;
|
|
76
|
+
const resolvedBuildContext = (0, lib_1.resolveCodeLocation)(buildContext, props.configRoot);
|
|
77
|
+
const dockerfileRelPath = props.config.dockerfile ?? 'Dockerfile';
|
|
78
|
+
const exclude = [
|
|
79
|
+
...lib_1.CONTAINER_CONTEXT_SECRET_EXCLUDES,
|
|
80
|
+
...readDockerignorePatterns(resolvedBuildContext),
|
|
81
|
+
...forceKeepDockerfilePatterns(dockerfileRelPath),
|
|
82
|
+
];
|
|
26
83
|
this.asset = new aws_s3_assets_1.Asset(this, 'SourceAsset', {
|
|
27
|
-
path:
|
|
84
|
+
path: resolvedBuildContext,
|
|
85
|
+
exclude,
|
|
86
|
+
ignoreMode: aws_cdk_lib_1.IgnoreMode.DOCKER,
|
|
28
87
|
});
|
|
29
88
|
}
|
|
30
89
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContainerSourceAsset.js","sourceRoot":"","sources":["../../../../../src/cdk/constructs/bundling/container/ContainerSourceAsset.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"ContainerSourceAsset.js","sourceRoot":"","sources":["../../../../../src/cdk/constructs/bundling/container/ContainerSourceAsset.ts"],"names":[],"mappings":";;;AAAA,yCAAyF;AAEzF,6CAAyC;AACzC,6DAAkD;AAClD,2CAAuC;AACvC,2BAA8C;AAC9C,+BAA4B;AAe5B;;;;;GAKG;AACH,SAAS,wBAAwB,CAAC,WAAmB;IACnD,MAAM,gBAAgB,GAAG,IAAA,WAAI,EAAC,WAAW,EAAE,eAAe,CAAC,CAAC;IAC5D,IAAI,CAAC,IAAA,eAAU,EAAC,gBAAgB,CAAC,EAAE,CAAC;QAClC,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO,IAAA,iBAAY,EAAC,gBAAgB,EAAE,OAAO,CAAC;SAC3C,KAAK,CAAC,OAAO,CAAC;SACd,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;SACxB,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;AAC9D,CAAC;AAED;;;;;;GAMG;AACH,SAAS,2BAA2B,CAAC,iBAAyB;IAC5D,MAAM,QAAQ,GAAG,iBAAiB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACpF,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACzC,QAAQ,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACtD,CAAC;IACD,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,QAAQ,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC1C,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAa,oBAAqB,SAAQ,sBAAS;IACjD;;OAEG;IACa,KAAK,CAAQ;IAE7B,YAAY,KAAgB,EAAE,EAAU,EAAE,KAAgC;QACxE,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAEjB,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,gBAAgB,IAAI,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC;QAChF,MAAM,oBAAoB,GAAG,IAAA,yBAAmB,EAAC,YAAY,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;QACjF,MAAM,iBAAiB,GAAG,KAAK,CAAC,MAAM,CAAC,UAAU,IAAI,YAAY,CAAC;QAElE,MAAM,OAAO,GAAG;YACd,GAAG,uCAAiC;YACpC,GAAG,wBAAwB,CAAC,oBAAoB,CAAC;YACjD,GAAG,2BAA2B,CAAC,iBAAiB,CAAC;SAClD,CAAC;QAEF,IAAI,CAAC,KAAK,GAAG,IAAI,qBAAK,CAAC,IAAI,EAAE,aAAa,EAAE;YAC1C,IAAI,EAAE,oBAAoB;YAC1B,OAAO;YACP,UAAU,EAAE,wBAAU,CAAC,MAAM;SAC9B,CAAC,CAAC;IACL,CAAC;CACF;AAzBD,oDAyBC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Asset } from 'aws-cdk-lib/aws-s3-assets';
|
|
2
|
+
import { Construct } from 'constructs';
|
|
3
|
+
export interface ContainerSourceAssetFromPathProps {
|
|
4
|
+
/**
|
|
5
|
+
* Absolute path to the directory containing the Dockerfile and source files.
|
|
6
|
+
*/
|
|
7
|
+
readonly sourcePath: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Packages a directory (containing a Dockerfile) as an S3 asset for CodeBuild.
|
|
11
|
+
* Unlike ContainerSourceAsset which resolves from an AgentEnvSpec, this takes a raw path.
|
|
12
|
+
*/
|
|
13
|
+
export declare class ContainerSourceAssetFromPath extends Construct {
|
|
14
|
+
readonly asset: Asset;
|
|
15
|
+
constructor(scope: Construct, id: string, props: ContainerSourceAssetFromPathProps);
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=ContainerSourceAssetFromPath.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContainerSourceAssetFromPath.d.ts","sourceRoot":"","sources":["../../../../../src/cdk/constructs/bundling/container/ContainerSourceAssetFromPath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,MAAM,WAAW,iCAAiC;IAChD;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED;;;GAGG;AACH,qBAAa,4BAA6B,SAAQ,SAAS;IACzD,SAAgB,KAAK,EAAE,KAAK,CAAC;gBAEjB,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,iCAAiC;CAOnF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ContainerSourceAssetFromPath = void 0;
|
|
4
|
+
const aws_s3_assets_1 = require("aws-cdk-lib/aws-s3-assets");
|
|
5
|
+
const constructs_1 = require("constructs");
|
|
6
|
+
/**
|
|
7
|
+
* Packages a directory (containing a Dockerfile) as an S3 asset for CodeBuild.
|
|
8
|
+
* Unlike ContainerSourceAsset which resolves from an AgentEnvSpec, this takes a raw path.
|
|
9
|
+
*/
|
|
10
|
+
class ContainerSourceAssetFromPath extends constructs_1.Construct {
|
|
11
|
+
asset;
|
|
12
|
+
constructor(scope, id, props) {
|
|
13
|
+
super(scope, id);
|
|
14
|
+
this.asset = new aws_s3_assets_1.Asset(this, 'SourceAsset', {
|
|
15
|
+
path: props.sourcePath,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.ContainerSourceAssetFromPath = ContainerSourceAssetFromPath;
|
|
20
|
+
//# sourceMappingURL=ContainerSourceAssetFromPath.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContainerSourceAssetFromPath.js","sourceRoot":"","sources":["../../../../../src/cdk/constructs/bundling/container/ContainerSourceAssetFromPath.ts"],"names":[],"mappings":";;;AAAA,6DAAkD;AAClD,2CAAuC;AASvC;;;GAGG;AACH,MAAa,4BAA6B,SAAQ,sBAAS;IACzC,KAAK,CAAQ;IAE7B,YAAY,KAAgB,EAAE,EAAU,EAAE,KAAwC;QAChF,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAEjB,IAAI,CAAC,KAAK,GAAG,IAAI,qBAAK,CAAC,IAAI,EAAE,aAAa,EAAE;YAC1C,IAAI,EAAE,KAAK,CAAC,UAAU;SACvB,CAAC,CAAC;IACL,CAAC;CACF;AAVD,oEAUC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/cdk/constructs/bundling/container/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,KAAK,yBAAyB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/cdk/constructs/bundling/container/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,KAAK,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAC9F,OAAO,EAAE,4BAA4B,EAAE,KAAK,iCAAiC,EAAE,MAAM,gCAAgC,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ContainerSourceAsset = void 0;
|
|
3
|
+
exports.ContainerSourceAssetFromPath = exports.ContainerSourceAsset = void 0;
|
|
4
4
|
var ContainerSourceAsset_1 = require("./ContainerSourceAsset");
|
|
5
5
|
Object.defineProperty(exports, "ContainerSourceAsset", { enumerable: true, get: function () { return ContainerSourceAsset_1.ContainerSourceAsset; } });
|
|
6
|
+
var ContainerSourceAssetFromPath_1 = require("./ContainerSourceAssetFromPath");
|
|
7
|
+
Object.defineProperty(exports, "ContainerSourceAssetFromPath", { enumerable: true, get: function () { return ContainerSourceAssetFromPath_1.ContainerSourceAssetFromPath; } });
|
|
6
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/cdk/constructs/bundling/container/index.ts"],"names":[],"mappings":";;;AAAA,+DAA8F;AAArF,4HAAA,oBAAoB,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/cdk/constructs/bundling/container/index.ts"],"names":[],"mappings":";;;AAAA,+DAA8F;AAArF,4HAAA,oBAAoB,OAAA;AAC7B,+EAAsH;AAA7G,4IAAA,4BAA4B,OAAA"}
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
* - container/ - Source assets for Container runtime
|
|
7
7
|
*/
|
|
8
8
|
export { BundledCodeZipAsset, type BundledCodeZipAssetProps, type PackageResult } from './zip';
|
|
9
|
+
export { NodeBundledCodeZipAsset } from './zip';
|
|
9
10
|
export { PythonBundledCodeZipAsset } from './zip';
|
|
10
11
|
export { ContainerSourceAsset, type ContainerSourceAssetProps } from './container';
|
|
12
|
+
export { ContainerSourceAssetFromPath, type ContainerSourceAssetFromPathProps } from './container';
|
|
11
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/cdk/constructs/bundling/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,mBAAmB,EAAE,KAAK,wBAAwB,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAC/F,OAAO,EAAE,yBAAyB,EAAE,MAAM,OAAO,CAAC;AAGlD,OAAO,EAAE,oBAAoB,EAAE,KAAK,yBAAyB,EAAE,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/cdk/constructs/bundling/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,mBAAmB,EAAE,KAAK,wBAAwB,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAC/F,OAAO,EAAE,uBAAuB,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,yBAAyB,EAAE,MAAM,OAAO,CAAC;AAGlD,OAAO,EAAE,oBAAoB,EAAE,KAAK,yBAAyB,EAAE,MAAM,aAAa,CAAC;AACnF,OAAO,EAAE,4BAA4B,EAAE,KAAK,iCAAiC,EAAE,MAAM,aAAa,CAAC"}
|