|
40 | 40 | .PHONY: clean |
41 | 41 | clean: |
42 | 42 | rm -rf $(VENV) |
| 43 | + |
| 44 | +# Create DynamoDB table |
| 45 | +.PHONY: create-dynamodb-table |
| 46 | +create-dynamodb-table: |
| 47 | + @echo "Creating DynamoDB table with name: $(TABLE_NAME)" |
| 48 | + aws dynamodb create-table \ |
| 49 | + --table-name $(TABLE_NAME) \ |
| 50 | + --attribute-definitions $(ATTRIBUTE_DEFINITIONS) \ |
| 51 | + --key-schema $(KEY_SCHEMA) \ |
| 52 | + --provisioned-throughput $(PROVISIONED_THROUGHPUT) |
| 53 | + |
| 54 | +# Usage: make create-dynamodb-table TABLE_NAME=my-table ATTRIBUTE_DEFINITIONS="AttributeName=Id,AttributeType=S" KEY_SCHEMA="AttributeName=Id,KeyType=HASH" PROVISIONED_THROUGHPUT="ReadCapacityUnits=5,WriteCapacityUnits=5" |
| 55 | + |
| 56 | +# Create Lambda function |
| 57 | +.PHONY: create-lambda-function |
| 58 | +create-lambda-function: |
| 59 | + @echo "Creating Lambda function with name: $(FUNCTION_NAME)" |
| 60 | + aws lambda create-function \ |
| 61 | + --function-name $(FUNCTION_NAME) \ |
| 62 | + --runtime python3.9 \ |
| 63 | + --role $(ROLE) \ |
| 64 | + --handler src.lambda_function.lambda_handler \ |
| 65 | + --zip-file fileb://$(ZIP_FILE) |
| 66 | + |
| 67 | +# Usage: make create-lambda-function FUNCTION_NAME=my-function ROLE=arn:aws:iam::123456789012:role/execution_role ZIP_FILE=function.zip |
| 68 | + |
| 69 | +# Create API Gateway |
| 70 | +.PHONY: create-api-gateway |
| 71 | +create-api-gateway: |
| 72 | + @echo "Creating API Gateway with name: $(API_NAME)" |
| 73 | + aws apigatewayv2 create-api \ |
| 74 | + --name $(API_NAME) \ |
| 75 | + --protocol-type $(PROTOCOL_TYPE) \ |
| 76 | + --target $(TARGET) \ |
| 77 | + |
| 78 | +# Usage: make create-api-gateway API_NAME=my-api API_DESCRIPTION="My API Gateway" |
| 79 | + |
| 80 | +# Create route in API Gateway |
| 81 | +.PHONY: create-route |
| 82 | +create-route: |
| 83 | + @echo "Creating route in API Gateway with name: $(ROUTE_NAME)" |
| 84 | + aws apigatewayv2 create-route \ |
| 85 | + --api-id $(API_ID) \ |
| 86 | + --route-key $(ROUTE_KEY) \ |
0 commit comments