File tree Expand file tree Collapse file tree 1 file changed +23
-24
lines changed Expand file tree Collapse file tree 1 file changed +23
-24
lines changed Original file line number Diff line number Diff line change 34
34
policy_arn = "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
35
35
)
36
36
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
+
37
60
# Define IAM policy for DynamoDB access
38
61
dynamodb_policy = aws .iam .Policy (
39
62
"dynamodb-policy" ,
66
89
policy_arn = dynamodb_scan_policy .arn
67
90
)
68
91
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
-
93
92
# Create a Lambda function using the Docker image
94
93
lambda_function = aws .lambda_ .Function ("my-serverless-function" ,
95
94
name = "my-serverless-function" ,
You can’t perform that action at this time.
0 commit comments