你如何授予iot:DescribeEndpoint权限给lambda ?

0

【以下的问题经过翻译处理】 如何将一个操作添加到默认的Lambda角色中?

        const p = new iam.ServicePrincipal('lambda.amazonaws.com');
        const role = new iam.Role(this, "someExecRoleID", {
                roleName: "someExecRole",
                assumedBy: p
            });
        role.grant(p, "iot:DescribeEndpoint");

        const serviceLambda = new nodejs.NodejsFunction(this, "WashnetEndpoints", {
                /* stuff deleted */
                handler: "getMqttEndpoint",
                role: role,
            }
        );

下面的错误,是因为我使用了lambda.amazonaws.com的service principal吗?

"AccessDeniedException: User: arn:aws:sts::312345678:assumed-role/blah is not authorized to perform: iot:DescribeEndpoint because no identity-based policy allows the iot:DescribeEndpoint action",
1 Risposta
0

【以下的回答经过翻译处理】 找到了文档(这通常是最困难的部分!)...似乎需要在resource部分配置“*”

profile picture
ESPERTO
con risposta 6 mesi fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande