Lambda function logs missing from CloudWatch when invoked from activity

0

Hello.

When using the "arn:aws:states:::lambda:invoke" resource to invoke lambda functions no output is sent to the CloudWatch logs.
Is there any parameter missing?
A sample activity has:

"PollQueryResult": {
"Type": "Task",
"Resource": "arn:aws:states:::lambda:invoke",
"Parameters": {
"FunctionName": "Function:$LATEST",
"Payload": {
"Input.$": "$.query.Payload"
}
},
"InputPath": "$",
"ResultPath": "$.poll",
"OutputPath": "$",
"Next": "QueryResultChoice",
}

Thanks.

posta 5 anni fa1186 visualizzazioni
1 Risposta
0

Found that the problem was with the ARNs provided to the IAM Policy.
To help others that eventually have this issues, below is the template I'm using for new policies:

      - Effect: Allow  
        Action:  
        - logs:CreateLogGroup  
        Resource: !Sub "arn:aws:logs:${AWS::Region}:${AWS::AccountId}:*"  
      - Effect: Allow  
        Action:  
        - logs:CreateLogStream  
        - logs:PutLogEvents  
        Resource:  
        - !Sub "arn:aws:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/<FUNCTIONAME>:*"  
        - !Sub "arn:aws:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/<FUNCTIONAME>:*"
con risposta 5 anni 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