Hi, I have some pseudo code (learning) that I'd li...
# help
r
Hi, I have some pseudo code (learning) that I'd like to access the paramenter store - not where where I would add the persmissions?
o
I think you’d add it to the function definition in SST https://docs.serverless-stack.com/constructs/v1/Function#permissions
r
This function is a target
receipt.handler
from the eventbus demo ..
o
Oh ok, you need to turn that into a Function object
r
So I want the target to access the parameter store .. there's no Function construct in the demo - perhaps needs to refactor it
o
Copy code
const RecieptHandler = new Function(stack, "RecieptHandler", {
  handler: "src/...",
});
and pass that into the EB targets array
I usually break stuff out into their own objects so that there’s not too much inlining
r
ah .. checking .. thx ..
Something like this works:
So that's all good, though I might change fun.attachPermissions(["ssm:GetParameter"]) to be more granular so that tihis lambda can only read that one secret in the matching environment (dev). So will need to craft something like this from the docs:
Copy code
fun.attachPermissions([
 new iam.PolicyStatement({
   actions: ["s3:*"],
   effect: iam.Effect.ALLOW,
   resources: [
     bucket.bucketArn + "/private/${<http://cognito-identity.amazonaws.com:sub|cognito-identity.amazonaws.com:sub>}/*",
   ],
 }),