1 Answer
- Newest
- Most votes
- Most comments
0
Hi,
I'll share my valid Lambda definition from the SAM YAML file.
- Target code: ./src/api/create_order.py
src ├── api │ ├── __init__.py │ ├── create_order.py └── layers └── utils.py
### Integrates the 🟠Lambda function AddOrderFunction: Type: AWS::Serverless::Function Properties: CodeUri: src/api Handler: create_order.lambda_handler Runtime: python3.9 Tracing: Active Policies: - DynamoDBCrudPolicy: TableName: !Ref OrdersTable Environment: Variables: TABLE_NAME: !Ref OrdersTable Events: ApiEvent: Type: Api Properties: Path: /orders Method: post RestApiId: !Ref WorkshopApiGateway
| Key point of properties | |
|---|---|
CodeUri | The local path to the function |
| e.g., src/api (the path from current directory) | |
Handler | The function within your code that is called to begin execution. |
| e.g., FILE_NAME(without .py).lambda_handler (Not lambda_function.handler) |
Note: AWS SAM template anatomy
I hope this helps!
answered 2 years ago
Relevant content
- asked 2 years ago
