File tree Expand file tree Collapse file tree 2 files changed +3
-10
lines changed Expand file tree Collapse file tree 2 files changed +3
-10
lines changed Original file line number Diff line number Diff line change 37
37
# Create Lambda execution role
38
38
lambda_role = aws .iam .Role (
39
39
"lambdaExecutionRole" ,
40
- assume_role_policy = json .dumps ({ # Use the json module to convert to a JSON string
40
+ assume_role_policy = json .dumps ({
41
41
"Version" : "2012-10-17" ,
42
42
"Statement" : [{
43
43
"Action" : "sts:AssumeRole" ,
50
50
})
51
51
)
52
52
53
- # Create inline policy for the role instead of a managed policy
53
+ # Create inline policy for the role
54
54
dynamodb_policy = aws .iam .RolePolicy (
55
55
"lambdaRolePolicy" ,
56
56
role = lambda_role .id ,
85
85
})
86
86
)
87
87
88
- # Attach the policy to the role
89
- lambda_dynamodb_policy_attachment = aws .iam .RolePolicyAttachment (
90
- "lambda-dynamodb-policy-attachment" ,
91
- role = lambda_role .name ,
92
- policy_arn = dynamodb_policy .arn
93
- )
94
-
95
88
# Create a Lambda function using the Docker image
96
89
lambda_function = aws .lambda_ .Function ("my-serverless-function" ,
97
90
name = "my-serverless-function" ,
Original file line number Diff line number Diff line change 23
23
24
24
# Connect to DynamoDB
25
25
dynamodb = boto3 .resource ('dynamodb' , region_name = 'us-east-1' )
26
- table = dynamodb .Table ("todo" )
26
+ table = dynamodb .Table ("todo-dev " )
27
27
28
28
@app .get ("/todos" , response_model = List [dict ])
29
29
async def get_todos ():
You can’t perform that action at this time.
0 commit comments