[{"data":1,"prerenderedAt":81},["ShallowReactive",2],{"pattern-agentcore-gateway-cedar-typescript-cdk":3,"pattern-group-agentcore-gateway-cedar-typescript-cdk":6},{"id":4,"title":5,"architectureURL":6,"cleanup":7,"contributors":10,"deploy":12,"description":17,"extension":18,"framework":19,"gitHub":20,"highlight":6,"introBox":24,"language":30,"level":31,"meta":32,"patternArch":33,"patternGroup":6,"patternGroupLabel":6,"resources":61,"stem":75,"testing":76,"videoId":6,"__hash__":80},"patterns\u002Fpatterns\u002Fagentcore-gateway-cedar-typescript-cdk.json","Amazon Bedrock AgentCore Gateway with Cedar policies and Amazon Cognito scopes",null,{"text":8},[9],"\u003Ccode>npx cdk destroy\u003C\u002Fcode>",[11],"content\u002Fcontributors\u002Fnithin-chandran-r.json",{"text":13},[14,15,16],"\u003Ccode>npm install\u003C\u002Fcode>","If this account and Region have never been used with the AWS CDK, run \u003Ccode>npx cdk bootstrap\u003C\u002Fcode> once.","\u003Ccode>npx cdk deploy\u003C\u002Fcode>","Per-tool authorization on an Amazon Bedrock AgentCore Gateway: Cedar policies allow each Amazon Cognito scope one AWS Lambda tool and deny the other.","json","AWS CDK",{"template":21},{"patternPath":22,"templateFile":23},"agentcore-gateway-cedar\u002Ftypescript\u002Fcdk","lib\u002Fagentcore-gateway-cedar-stack.ts",{"headline":25,"text":26},"How it works",[27,28,29],"This pattern deploys an Amazon Bedrock AgentCore Gateway with an AWS Lambda target that exposes two tools. A policy engine from Policy in Amazon Bedrock AgentCore is attached to the gateway in ENFORCE mode, and Cedar denies every tool call unless a policy permits it.","Amazon Cognito has one app client per scope (OAuth 2.0 client credentials). The gateway JWT authorizer accepts tokens from these clients, and each Cedar policy permits one tool when the scope claim of the access token contains the matching scope.","With the same gateway, one token is allowed lookup_order and denied cancel_order, and the other token is the reverse. The decision is taken inside the gateway, so the denied call does not invoke the function.","TypeScript","300",{},{"icon1":34,"icon2":39,"icon3":43,"icon4":47,"line1":51,"line2":55,"line3":58},{"x":35,"y":36,"service":37,"label":38},12,50,"cognito","Amazon Cognito\nM2M client",{"x":40,"y":36,"service":41,"label":42},37,"icon-internet","MCP client",{"x":44,"y":36,"service":45,"label":46},63,"bedrock-agentcore","AgentCore Gateway\nCedar policy",{"x":48,"y":36,"service":49,"label":50},88,"lambda-event-functions","AWS Lambda\nOrder tools",{"from":52,"to":53,"label":54},"icon1","icon2","Token",{"from":53,"to":56,"label":57},"icon3","tools\u002Fcall",{"from":56,"to":59,"label":60},"icon4","Permitted",{"bullets":62},[63,66,69,72],{"text":64,"link":65},"Policy in Amazon Bedrock AgentCore","https:\u002F\u002Fdocs.aws.amazon.com\u002Fbedrock-agentcore\u002Flatest\u002Fdevguide\u002Fpolicy.html",{"text":67,"link":68},"Principal-scoped Cedar policy examples","https:\u002F\u002Fdocs.aws.amazon.com\u002Fbedrock-agentcore\u002Flatest\u002Fdevguide\u002Fexample-policies-principal.html",{"text":70,"link":71},"IAM permissions for Gateway with Policy","https:\u002F\u002Fdocs.aws.amazon.com\u002Fbedrock-agentcore\u002Flatest\u002Fdevguide\u002Fpolicy-permissions.html",{"text":73,"link":74},"Set up inbound authorization for your gateway","https:\u002F\u002Fdocs.aws.amazon.com\u002Fbedrock-agentcore\u002Flatest\u002Fdevguide\u002Fgateway-inbound-auth.html","patterns\u002Fagentcore-gateway-cedar-typescript-cdk",{"text":77},[78,79],"Get an access token for each Amazon Cognito app client, then call lookup_order and cancel_order through the gateway MCP endpoint with each token. Expected: each token is allowed one tool and denied the other.","See the GitHub repo for the exact commands, the check that denied calls do not invoke the function, and the expected output.","AJTInsjd-LsplGvTv03RAg5kLFic6T6Dj0ShfBt2-nk",1795084457782]