• 沒有找到結果。

HttpApi Authorization

HttpApi Event that uses a specific path and method.

YAML

Events:

HttpApiEvent:

Type: HttpApi Properties:

Path: / Method: GET

HttpApi Authorization

HttpApi Event that uses an Authorizer.

YAML

Events:

HttpApiEvent:

Type: HttpApi Properties:

Path: /authenticated Method: GET

Auth:

Authorizer: OpenIdAuth AuthorizationScopes:

- scope1 - scope2

HttpApiFunctionAuth

Configures authorization at the event level.

Configure Auth for a specific API + Path + Method

Syntax

To declare this entity in your AWS Serverless Application Model (AWS SAM) template, use the following syntax.

YAML

AuthorizationScopes: List Authorizer: String

Properties

AuthorizationScopes

The authorization scopes to apply to this API, path, and method.

Scopes listed here will override any scopes applied by the DefaultAuthorizer if one exists.

Type: List Required: No

AWS CloudFormation compatibility: This property is unique to AWS SAM and doesn't have an AWS CloudFormation equivalent.

Authorizer

The Authorizer for a specific Function

If you have specified a Global Authorizer on the API and want to make a specific Function public, override by setting Authorizer to NONE.

Type: String Required: No

AWS CloudFormation compatibility: This property is unique to AWS SAM and doesn't have an AWS CloudFormation equivalent.

Examples Function-Auth

Specifing Authorization at Function level

YAML

Auth:

Authorizer: OpenIdAuth AuthorizationScopes:

- scope1 - scope2

IoTRule

The object describing an IoTRule event source type.

Creates an AWS::IoT::TopicRule resource to declare an AWS IoT rule. For more information see AWS CloudFormation documentation

Syntax

To declare this entity in your AWS Serverless Application Model (AWS SAM) template, use the following syntax.

YAML

AwsIotSqlVersion: String Sql: String

Properties

AwsIotSqlVersion

The version of the SQL rules engine to use when evaluating the rule.

Type: String Required: No

AWS CloudFormation compatibility: This property is passed directly to the AwsIotSqlVersion property of an AWS::IoT::TopicRule TopicRulePayload resource.

Sql

The SQL statement used to query the topic. For more information, see AWS IoT SQL Reference in the AWS IoT Developer Guide.

Type: String Required: Yes

AWS CloudFormation compatibility: This property is passed directly to the Sql property of an AWS::IoT::TopicRule TopicRulePayload resource.

Examples IOT Rule

IOT Rule Example

YAML

IoTRule:

Type: IoTRule Properties:

Sql: SELECT * FROM 'topic/test'

Kinesis

The object describing a Kinesis event source type. For more information, see Using AWS Lambda with Amazon Kinesis in the AWS Lambda Developer Guide.

AWS SAM generates an AWS::Lambda::EventSourceMapping resource when this event type is set.

Syntax

To declare this entity in your AWS Serverless Application Model (AWS SAM) template, use the following syntax.

YAML

BatchSize: Integer

BisectBatchOnFunctionError: Boolean DestinationConfig: DestinationConfig Enabled: Boolean

FilterCriteria: FilterCriteria FunctionResponseTypes: List

MaximumBatchingWindowInSeconds: Integer MaximumRecordAgeInSeconds: Integer MaximumRetryAttempts: Integer ParallelizationFactor: Integer StartingPosition: String Stream: String

TumblingWindowInSeconds: Integer

Properties

BatchSize

The maximum number of items to retrieve in a single batch.

Type: Integer Required: No Default: 100

AWS CloudFormation compatibility: This property is passed directly to the BatchSize property of an AWS::Lambda::EventSourceMapping resource.

Minimum: 1 Maximum: 10000

BisectBatchOnFunctionError

If the function returns an error, split the batch in two and retry.

Type: Boolean Required: No

AWS CloudFormation compatibility: This property is passed directly to the

BisectBatchOnFunctionError property of an AWS::Lambda::EventSourceMapping resource.

DestinationConfig

An Amazon Simple Queue Service (Amazon SQS) queue or Amazon Simple Notification Service (Amazon SNS) topic destination for discarded records.

Type: DestinationConfig Required: No

AWS CloudFormation compatibility: This property is passed directly to the DestinationConfig property of an AWS::Lambda::EventSourceMapping resource.

Enabled

Disables the event source mapping to pause polling and invocation.

Type: Boolean Required: No

AWS CloudFormation compatibility: This property is passed directly to the Enabled property of an AWS::Lambda::EventSourceMapping resource.

FilterCriteria

A object that defines the criteria to determine whether Lambda should process an event. For more information, see AWS Lambda event filtering in the AWS Lambda Developer Guide.

Type: FilterCriteria Required: No

AWS CloudFormation compatibility: This property is passed directly to the FilterCriteria property of an AWS::Lambda::EventSourceMapping resource.

FunctionResponseTypes

A list of the response types currently applied to the event source mapping. For more information, see Reporting batch item failures in the AWS Lambda Developer Guide.

Valid values: ReportBatchItemFailures Type: List

Required: No

AWS CloudFormation compatibility: This property is passed directly to the

FunctionResponseTypes property of an AWS::Lambda::EventSourceMapping resource.

MaximumBatchingWindowInSeconds

The maximum amount of time to gather records before invoking the function, in seconds.

Type: Integer Required: No

AWS CloudFormation compatibility: This property is passed directly to the

MaximumBatchingWindowInSeconds property of an AWS::Lambda::EventSourceMapping resource.

MaximumRecordAgeInSeconds

The maximum age of a record that Lambda sends to a function for processing.

Type: Integer Required: No

AWS CloudFormation compatibility: This property is passed directly to the

MaximumRecordAgeInSeconds property of an AWS::Lambda::EventSourceMapping resource.

MaximumRetryAttempts

The maximum number of times to retry when the function returns an error.

Type: Integer Required: No

AWS CloudFormation compatibility: This property is passed directly to the MaximumRetryAttempts property of an AWS::Lambda::EventSourceMapping resource.

ParallelizationFactor

The number of batches to process from each shard concurrently.

Type: Integer Required: No

AWS CloudFormation compatibility: This property is passed directly to the

ParallelizationFactor property of an AWS::Lambda::EventSourceMapping resource.

StartingPosition

The position in a stream from which to start reading.

Valid values: TRIM_HORIZON or LATEST Type: String

Required: Yes

AWS CloudFormation compatibility: This property is passed directly to the StartingPosition property of an AWS::Lambda::EventSourceMapping resource.

Stream

The Amazon Resource Name (ARN) of the data stream or a stream consumer.

Type: String Required: Yes

AWS CloudFormation compatibility: This property is passed directly to the EventSourceArn property of an AWS::Lambda::EventSourceMapping resource.

TumblingWindowInSeconds

The duration, in seconds, of a processing window. The valid range is 1 to 900 (15 minutes).

For more information, see Tumbling windows in the AWS Lambda Developer Guide.

Type: Integer Required: No

AWS CloudFormation compatibility: This property is passed directly to the

TumblingWindowInSeconds property of an AWS::Lambda::EventSourceMapping resource.

Examples