1 Answer
- Newest
- Most votes
- Most comments
1
For this you can use the add_role_to_policy function:
from aws_cdk import aws_lambda as _lambda
from aws_cdk.aws_lambda_python import PythonFunction
from aws_cdk import aws_iam as iam
my_function = PythonFunction(
#function logic
)
my_function.add_to_role_policy(iam.PolicyStatement(
effect=iam.Effect.ALLOW,
actions=[
'dynamodb:GetItem',
],
resources=[
'TABLE_ARN',
],
))
The above policy uses Python and grants the Lambda GetItem permissions on the DynamoDB table which ARN you provide.
More info can be found here
Relevant content
asked a year ago
asked 4 years ago
asked 3 years ago
- AWS OFFICIALUpdated 2 years ago
