Skip to content

Commit 64d40a4

Browse files
author
Adetokunbo Ige
committed
chore: update policy
Signed-off-by: Adetokunbo Ige <[email protected]>
1 parent 8b6f6bc commit 64d40a4

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

todo-app/__main__.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
# Create Lambda execution role
3838
lambda_role = aws.iam.Role(
3939
"lambdaExecutionRole",
40-
assume_role_policy=json.dumps({ # Use the json module to convert to a JSON string
40+
assume_role_policy=json.dumps({
4141
"Version": "2012-10-17",
4242
"Statement": [{
4343
"Action": "sts:AssumeRole",
@@ -50,7 +50,7 @@
5050
})
5151
)
5252

53-
# Create inline policy for the role instead of a managed policy
53+
# Create inline policy for the role
5454
dynamodb_policy = aws.iam.RolePolicy(
5555
"lambdaRolePolicy",
5656
role=lambda_role.id,
@@ -85,13 +85,6 @@
8585
})
8686
)
8787

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-
9588
# Create a Lambda function using the Docker image
9689
lambda_function = aws.lambda_.Function("my-serverless-function",
9790
name="my-serverless-function",

todo-app/lambda_function/lambda.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
# Connect to DynamoDB
2525
dynamodb = boto3.resource('dynamodb', region_name='us-east-1')
26-
table = dynamodb.Table("todo")
26+
table = dynamodb.Table("todo-dev")
2727

2828
@app.get("/todos", response_model=List[dict])
2929
async def get_todos():

0 commit comments

Comments
 (0)