0

我有一个 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 
4

1 回答 1

1

将 cloudformation(或 sam)变量传递给 lambda 的常用方法是通过Environment Variables

在您的模板中,您使用Environment属性指定变量。

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

于 2020-03-16T04:38:14.840 回答