Skip to content

Commit 1d79fd3

Browse files
author
Adetokunbo Ige
committed
chore: update policy
Signed-off-by: Adetokunbo Ige <[email protected]>
1 parent a00511b commit 1d79fd3

File tree

1 file changed

+23
-24
lines changed

1 file changed

+23
-24
lines changed

todo-app/__main__.py

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,29 @@
3434
policy_arn="arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
3535
)
3636

37+
# Define a DynamoDB table
38+
dynamodb_table = aws.dynamodb.Table(
39+
f"todo-{environment}",
40+
name=f"todo-{environment}", # Explicit table name
41+
hash_key="id",
42+
range_key="timestamp",
43+
attributes=[
44+
aws.dynamodb.TableAttributeArgs(
45+
name="id",
46+
type="S"
47+
),
48+
aws.dynamodb.TableAttributeArgs(
49+
name="timestamp",
50+
type="N"
51+
),
52+
],
53+
billing_mode="PAY_PER_REQUEST",
54+
tags={
55+
"Environment": environment,
56+
"Created_By": "Pulumi"
57+
}
58+
)
59+
3760
# Define IAM policy for DynamoDB access
3861
dynamodb_policy = aws.iam.Policy(
3962
"dynamodb-policy",
@@ -66,30 +89,6 @@
6689
policy_arn=dynamodb_scan_policy.arn
6790
)
6891

69-
# Define a DynamoDB table
70-
# Define DynamoDB Table
71-
dynamodb_table = aws.dynamodb.Table(
72-
f"todo-{environment}",
73-
name=f"todo-{environment}", # Explicit table name
74-
hash_key="id",
75-
range_key="timestamp",
76-
attributes=[
77-
aws.dynamodb.TableAttributeArgs(
78-
name="id",
79-
type="S"
80-
),
81-
aws.dynamodb.TableAttributeArgs(
82-
name="timestamp",
83-
type="N"
84-
),
85-
],
86-
billing_mode="PAY_PER_REQUEST",
87-
tags={
88-
"Environment": environment,
89-
"Created_By": "Pulumi"
90-
}
91-
)
92-
9392
# Create a Lambda function using the Docker image
9493
lambda_function = aws.lambda_.Function("my-serverless-function",
9594
name="my-serverless-function",

0 commit comments

Comments
 (0)