Last active
October 27, 2019 16:29
-
-
Save mgjam/a55631a9c01020636401c61097361ba5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private createOutputLambdaInvokeRole( | |
outputLambda: lambda.Function | |
): iam.Role { | |
const name = 'OutputLambdaAppSyncInvokeRole'; | |
const invokeRole = new iam.Role(this, name, { | |
roleName: name, | |
assumedBy: new iam.ServicePrincipal('appsync.amazonaws.com') | |
}); | |
invokeRole.attachInlinePolicy(this.createOutputLambdaInvokePolicy(outputLambda)); | |
return invokeRole; | |
} | |
private createOutputLambdaInvokePolicy( | |
outputLambda: lambda.Function | |
): iam.Policy { | |
const name = 'OutputLambdaAppSyncInvokePolicy'; | |
return new iam.Policy(this, name, { | |
policyName: name, | |
statements: [new iam.PolicyStatement({ | |
effect: iam.Effect.ALLOW, | |
actions: [ 'lambda:InvokeFunction' ], | |
resources: [ outputLambda.functionArn ] | |
})] | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment