Implement AWS Verified Permission using AWS Lambda

0

import { VerifiedPermissions } from "@aws-sdk/client-verifiedpermissions"; export const handler = async (event) => { try { var verifiedpermissions = await new VerifiedPermissions();

var params = {
  validationSettings: {
    mode: "OFF" /* required */,
  },
  clientToken: "d876e578-b6c6-4251-bbf5-6366c5d69abc",
};
const createPolicyStore_ = await verifiedpermissions.createPolicyStore(
  params
);
return createPolicyStore_;

} catch (error) { throw new Error(error); } }; This is my Lambda function. I have also integrated the AWS SDK for JavaScript into my Node.js Lambda function using layers. But I am getting the below error when implementing AWS Verified Permission with Lambda: "errorMessage": "AccessDeniedException: User: arn:aws:sts::xxxxxxxx:assumed-role/verifiedPermissionTest-role-cj3t6pqg/verifiedPermissionTest is not authorized to perform: verifiedpermissions:createpolicystore on resource: * because no identity-based policy allows the verifiedpermissions:createpolicystore action"

Sulu
已提問 6 個月前檢視次數 255 次
1 個回答
0

Hello.

Judging from the content of the error, it seems that the IAM role does not allow "verifiedpermissions:createpolicystore", but how is the IAM role configured?
https://docs.aws.amazon.com/service-authorization/latest/reference/list_amazonverifiedpermissions.html

profile picture
專家
已回答 6 個月前
profile pictureAWS
專家
已審閱 6 個月前
  • But I have added the policy that permits the user to perform all the actions in Verified Permission.This is the policy statement: { "Version": "2012-10-17", "Statement": [ { "Sid": "VisualEditor0", "Effect": "Allow", "Action": "verifiedpermissions:", "Resource": "" } ] }

  • Please check again whether the settings are configured in the IAM role used by Lambda. Also, to check the operation, temporarily set strong privileges such as AdministratorAccess and see if it works without any problems. In other cases, it may be possible to check CloudTrail events and check the missing permissions.

  • not sure if cut/paste error because of formatting, but is Action "verifiedpermissions:" missing the * after the : - it should be "verifiedpermissions:*"

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南