-
Notifications
You must be signed in to change notification settings - Fork 10
Description
Description
Currently, the Container build type always builds images via AWS CodeBuild during agentcore deploy. This doesn't support workflows where users cross-compile for a different architecture, use custom CI/CD pipelines that push images to ECR before deploying, or want to avoid redundant builds when the image already exists in ECR.
Add a --container-uri <uri> flag to agentcore deploy that accepts a pre-built ECR image URI and wires it directly to AgentCoreRuntime, bypassing the CodeBuild step entirely.
Example usage:
agentcore deploy -y --container-uri 123456789012.dkr.ecr.us-west-2.amazonaws.com/myproject/myagent:abc123
The container URI is passed to the CDK app via an environment variable (AGENTCORE_CONTAINER_URI) so the CDK toolkit wrapper doesn't need modification. When set, the CDK stack creates an AgentCoreRuntime construct directly with the pre-built image instead of going through the AgentCoreApplication (CodeBuild) path.
Acceptance Criteria
-
agentcore deploy --container-uri <uri>deploys using the provided ECR image without triggering a CodeBuild build - Invalid ECR URI formats are rejected with a clear error message before deployment starts
- Dockerfile validation is skipped when
--container-uriis provided - The flag triggers non-interactive (CLI) mode
-
DeployOptionsandValidatedDeployOptionsinterfaces include the optionalcontainerUrifield - The CDK stack branches correctly:
containerUriset →AgentCoreRuntimewith pre-built image; unset → existingAgentCoreApplication(CodeBuild) path -
CfnOutputforRuntimeIdandRuntimeArnis emitted in the pre-built image path - Unit tests cover: URI validation (valid/invalid formats), Dockerfile validation skip, env var propagation, CDK stack branching logic
- Existing Container build type (no
--container-uri) continues to work unchanged
Additional Context
This currently assumes a single agent (spec.agents[0]). We likely would want to address multi-agent/multi-URI mappings somehow.
The ECR repo must already exist with the referenced tag.