* Which Category is your question related to? *
Functions
* What AWS Services are you utilizing? *
Lambda (and others - but not relevant to this question)
* Provide additional details e.g. code snippets *
I'm using AWS Amplify CLI Multienv 20, I'd like to be able to invoke another (Amplify managed) lambda function from my Amplify managed lambda function - I need to grant the invoking lambda the role that permits it to invoke my second lambda - however I cannot find any way to manage this with amplify?
If I edited the CFT, it could get over-written and it would be different between environments? Any advice, or is this not a feature available?
@ReidWeb I beleive the CFT template won't get modified for the Lambda function. You can go ahead and modify it in the amplify/backend directory.
Ah that's good to know! Managed to add a segment to the lambda policy that'll allow me to invoke the secondary lambda
{
"Effect":"Allow",
"Action":"lambda:InvokeFunction",
"Resource":{
"Fn::Sub":[
"arn:aws:lambda:${region}:${account}:function:funcName-${env}",
{
"region":{
"Ref":"AWS::Region"
},
"account":{
"Ref":"AWS::AccountId"
},
"lambda":{
"Ref":"LambdaFunction"
},
"env":{
"Ref":"env"
}
}
]
}
}
so 馃it should work across environments - I'll reopen this if I face issues when promoting
Thanks @ReidWeb , That little code worked for me! In my case, I'm trying to execute another lambda through the post-confirmation lambda, because I have this issue: https://stackoverflow.com/questions/62503523/trying-to-use-model-within-post-confirmation-function