docs(payments): correct T02 description of the runtime execution role#1677
Closed
fahadfa-aws wants to merge 2 commits into
Closed
docs(payments): correct T02 description of the runtime execution role#1677fahadfa-aws wants to merge 2 commits into
fahadfa-aws wants to merge 2 commits into
Conversation
The "Key Concepts" section called the execution role `ProcessPaymentRole` and described it as having "explicit denies on CreatePaymentSession, CreatePaymentInstrument, and all control-plane operations." Two factual errors in one sentence: 1. The deployed runtime is not bound to AgentCorePaymentsProcessPaymentRole. `deploy_payment_agent.py` runs `agentcore deploy -y` and the CLI's CDK construct creates a fresh execution role itself. The script then attaches a narrow inline policy to whichever auto-created role it finds. The runtime's roleArn returned by GetAgentRuntime is that auto-created role, not the role utils.py creates. 2. Per the official IAM roles guide for AgentCore payments, the `Deny ProcessPayment` statement lives on **ManagementRole**, not on ProcessPaymentRole. ProcessPaymentRole's design is narrow scope (Allow only ProcessPayment + read APIs); the absence of CreateSession and CreateInstrument is what enforces separation, not a Deny. Update the section to describe what actually happens — the auto-created execution role plus the inline PaymentDataPlaneAccess policy. Cross-link to the AWS IAM roles guide so users see the canonical separation pattern. Add a code comment near the IAM attach in deploy_payment_agent.py explaining that the CLI's `agentcore.json` schema (`AgentEnvSpec`) does not currently expose `executionRoleArn`, so binding the runtime to a caller-managed role is not possible today. The narrow inline policy is the workaround. Verified: - AWS Knowledge MCP confirmed the canonical IAM separation pattern (Deny on ManagementRole, narrow scope on ProcessPaymentRole) - Live deploy on us-west-2: runtime roleArn was the auto-CDK role (AgentCore-PaymentAgent-de-ApplicationAgentPaymentAg-...), inline policy was Allow-only as written by the script. Stack torn down.
Replace the API-name list and the slightly defensive 'this matches' phrasing with a tighter contrast: narrow scope is what enforces the boundary on the execution role; the explicit Deny lives on the management role.
Author
|
@mvangara10 — flagging this for your review when you have a moment. Tagged across the full set of payments-tutorial fixes I've been pushing today; happy to walk through any of them. Audit logs and test evidence are referenced in the PR description. |
Author
|
Superseded by #1738 (consolidated PR) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
The Tutorial 02 README "Key Concepts" section described the execution role as
ProcessPaymentRolewith "explicit denies onCreatePaymentSession,CreatePaymentInstrument, and all control-plane operations." Two factual problems:The deployed runtime is not bound to
AgentCorePaymentsProcessPaymentRole.deploy_payment_agent.py:154runsagentcore deploy -y, and the CLI's CDK construct creates a fresh execution role itself. The script then attaches a narrow inline policy (PaymentDataPlaneAccess) to whichever auto-created role it finds. The runtime'sroleArnreturned byGetAgentRuntimeis that auto-created role.The
Deny ProcessPaymentstatement lives on the management role, not onProcessPaymentRole. The official IAM guide puts the explicitDeny ProcessPaymentonManagementRole(the role used by app backends to create sessions).ProcessPaymentRole's design pattern is narrow scope — Allow onlyProcessPaymentand the read APIs, and the absence ofCreatePaymentSession/CreatePaymentInstrumentenforces separation.utils.pymatches the AWS-docs pattern correctly:MANAGEMENT_ROLEhas\"deny\": [\"bedrock-agentcore:ProcessPayment\"];PROCESS_PAYMENT_ROLEhas onlyallow:with nodeny:key.Changes
deploy_payment_agent.pyattaches. Cross-link to the AWS IAM roles guide.agentcore.json(AgentEnvSpec) does not currently exposeexecutionRoleArn, so the runtime cannot be bound to a caller-managed role today. The narrow inline policy is the workaround that achieves the same separation.Docs + one code comment. No behavior change.
Verification
AWS Knowledge MCP — re-read
payments-iam-roles.html. Confirmed: "The explicit Deny on ProcessPayment in the management role" and the literalStatement[Sid: \"DenyProcessPayment\", Effect: \"Deny\", Action: \"bedrock-agentcore:ProcessPayment\"]is shown in theManagementRolepolicy block. TheProcessPaymentRolepolicy block has only Allow statements.Live AWS — fresh deploy on
us-west-2against180780550628:agentcore deploycreated CFN stackAgentCore-PaymentAgent-defaultGetAgentRuntimereturnedroleArn = AgentCore-PaymentAgent-de-ApplicationAgentPaymentAg-C28in3waHa31(auto-CDK), notAgentCorePaymentsProcessPaymentRoleGetRolePolicy(PaymentDataPlaneAccess)returned the literal Allow-only policy fromdeploy_payment_agent.py:170-191— noDenystatements anywhereCLI schema — read the scaffolded
agentcore/.llm-context/agentcore.ts. TheAgentEnvSpecinterface (the runtime config inagentcore.json) has fieldsname, build, entrypoint, codeLocation, runtimeVersion, envVars, networkMode, networkConfig, instrumentation, protocol, tags, filesystemConfigurations— noexecutionRoleArn. So binding to a caller-managed role isn't possible with CLI 0.19; the inline-policy approach is the available pattern.