Branko Gvoka
09/27/2021, 5:50 PMfromTopicArn
but cant figure out how to set the function/api to allow sns:Publish, I used to set default functio props to include in permissions [topic] 🙂
The error I get user with xxx cant publish to yyy topic
Thanks!thdxr
09/27/2021, 5:51 PMBranko Gvoka
09/27/2021, 5:52 PMnew cdk.aws() -
iam.PolicyStatement({
actions: ["execute-api:Invoke"],
effect: cdk.aws - iam.Effect.ALLOW,
resources: [
`arn:aws:execute-api:${region}:${account}:${api.httpApiId}/*`,
],
}),
or
get via arn the topic and pass it as permissions as wellBranko Gvoka
09/27/2021, 5:53 PM"errorMessage": "User: arn:aws:sts::xxxxxxxxxxxxxxxx:assumed-role/july7brole/july7b_face_detect is not authorized to perform: SNS:Publish on resource: +1xxxxxxxxx",
thdxr
09/27/2021, 6:02 PMpermissions: [topic]
should workthdxr
09/27/2021, 6:02 PMBranko Gvoka
09/27/2021, 6:03 PM'User: arn:aws:sts::XXXX:assumed-role/branko-pms-integrati-LalaApiLambdaANYmooo-TXXXX/branko-XXX is not authorized to perform: SNS:Publish on resource: arn:aws:sns:eu-central-1:XXXX:dev-xxx'
thdxr
09/27/2021, 7:02 PMpermissions: ["sns"]
and see if that works?Branko Gvoka
09/28/2021, 8:54 PMconst defaultFunctionProps = {
srcPath: SRC_PATH,
permissions: ['sns', bucket],
};
new sst.Api(this, `${SERVICE_NAME}Api`, {
defaultFunctionProps,
httpApi: HttpApi.fromHttpApiAttributes(this, 'Api', {
httpApiId,
}),
routes: {
[`ANY ${routes.HSK_ROUTE_PREFIX}/{proxy+}`]: 'src/lambda.handler',
},
});
I get
arn:aws:sts::XXXXX:assumed-role/branko-integrati-HskApiLambdaANYhousekeep-TU4459NAO7Q5/branko-integrati-HskApiLambdaANYhousekeep-xxxx
thdxr
09/28/2021, 8:57 PMBranko Gvoka
09/28/2021, 8:57 PMthdxr
09/28/2021, 8:58 PM"GET /": {
permissions: ["sns", bucket],
handler: "src/lambda.handler",
},
Branko Gvoka
09/28/2021, 9:09 PM{
"Action": "sns:*",
"Resource": "*",
"Effect": "Allow"
}
but not sure why / which user its being used for executing itBranko Gvoka
09/28/2021, 9:10 PMBranko Gvoka
09/28/2021, 9:11 PMthdxr
09/28/2021, 9:19 PMsst start
thdxr
09/28/2021, 9:19 PMthdxr
09/28/2021, 9:19 PMBranko Gvoka
09/28/2021, 9:28 PMthdxr
09/28/2021, 9:34 PMBranko Gvoka
09/28/2021, 9:39 PMthdxr
09/28/2021, 9:49 PMthdxr
09/28/2021, 9:49 PMBranko Gvoka
09/28/2021, 9:53 PM