如何读取.NET lambda函数中的aws-sam参数



我有一个SAM模板,它接受.yml文件中的参数,我想访问用c#编写的lambda函数中的参数值

这是SAM模板

AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >      
Globals:
Function:
Timeout: 60
Runtime: dotnetcore2.1
Parameters: 
ApiBaseUri: 
Type: String
Default: https://postb.in/1584332032935-8906962152104
Description: The API URL where the received events will be pushed by the lambda function
Resources:
PushUpdates:
Type: AWS::Serverless::Function
Properties:
CodeUri: ./src/PushAPIs/
Handler: Localgov.Microservices::LambPaymentTracker.UpdateHandler::PushBurtonUpdates
Runtime: dotnetcore2.1
Policies: AWSLambdaDynamoDBExecutionRole
Events:
Stream:
Type: DynamoDB
Properties:
Stream: !GetAtt UpdatesTable.StreamArn
BatchSize: 100
StartingPosition: TRIM_HORIZON 

将cloudformation(或sam(变量传递到lambda的常见方式是通过环境变量。

在模板中,可以使用Environment属性指定变量。

在代码中,您可以使用特定于编程语言的功能来读取它们。

最新更新