Error when Bedrock agent invoke lambda

1

I have created an AWS bedrock agent, when invoking the lambda I receive the following error:

Access denied while invoking Lambda function arn:aws:lambda:us-east-1:XXXXXXXXXXXXXX:function:InsuranceClaimsLambda. Check the permissions on Lambda function and retry the request.

Can you help me?

4개 답변
2
수락된 답변

hey, i feel your BedRock agent IAM Service role is missing lambda:InvokeFunction permission to invoke a lambda function. Make sure to give this permission to BedRock agent on resource(your lambda function ARN) lambda function. Let me if you need something.

profile picture
답변함 6달 전
profile picture
전문가
검토됨 하루 전
profile pictureAWS
전문가
검토됨 6달 전
2

Was able to solve my issue. You need to add a resource-based policy statement on the Lambda.

  1. Go into Lambda function
  2. Select Configuration tab
  3. Select Permission menu item
  4. Scroll down to Resource-based Policy Statements and click Add Permissions button
  5. Click AWS Service radio button
  6. Choose Other from the Service dropdown
  7. Enter anything for Statement ID
  8. Enter bedrock.amazonaws.com for the Principal
  9. Enter your Bedrock Agent's ARN as the Source ARN
  10. Select lambda:InvokeFunctionas the Action
  11. Click Save
답변함 4달 전
0

I'm having same error. I gave both Bedrock Agent IAM role and Lambda role AdministratorAccess policy and still getting the error. Executing the Lambda manually is fine but can't run test with Bedrock Agent.

The trace from the Bedrock Agent test shows that in pre-processing step, it correctly classified my input. The orchestration step shows that it understood the input correctly and was ready to call the right function with the right mapping of parameters. But that's all I see. There's only that single step and nothing else and there's nothing on the post-processing tab.

The error states Access denied while invoking Lambda function arn:aws:lambda:us-west-2:xxxxxxxxxxxx:function:yyyyyy Check the permissions on Lambda function and retry the request. I checked the CloudWatch logs for the Lambda and there's nothing which seems to confirm Bedrock is unable to even invoke the Lambda function.

답변함 4달 전
0

To complete the answer here is the CDK way to add this Resource-based Policy Statement:

lambda_.CfnPermission(
      self,
      "BedrockInvocationPermission",
       action="lambda:InvokeFunction",
       function_name=action_group_function.function_name,
       principal="bedrock.amazonaws.com",
       source_arn=agent.agent_arn,
)

MLGuy
답변함 2달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠