使用中其他支持的属性来定义资源 Amazon SAM - Amazon Serverless Application Model
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

使用中其他支持的属性来定义资源 Amazon SAM

对于源资源和目标资源,如果在同一个模板中定义,则使用 Id 属性。或者,可以添加 Qualifier 以缩小您定义的资源范围。当资源不在同一个模板中时,请使用受支持属性的组合。

在定义具有 Id 之外属性的源资源时,请使用 SourceReference 属性。

AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 ... Resources: <source-resource-logical-id>: Type: <resource-type> ... Connectors: <connector-name>: Properties: SourceReference: Qualifier: <optional-qualifier> <other-supported-properties> Destination: <properties-that-identify-destination-resource> Permissions: <permission-types-to-provision>

以下是使用缩小 Amazon API Gateway 资源的范围的示例:Qualifier

AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 ... Resources: MyApi: Type: AWS::Serverless::Api Connectors: ApiToLambdaConn: Properties: SourceReference: Qualifier: Prod/GET/foobar Destination: Id: MyFunction Permissions: - Write ...

以下示例使用支持的 ArnType 组合定义来自另一个模板的目标资源:

AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 ... Resources: MyFunction: Type: AWS::Serverless::Function Connectors: TableConn: Properties: Destination: Type: AWS::DynamoDB::Table Arn: !GetAtt MyTable.Arn ...

有关使用连接器的更多信息,请参阅 Amazon SAM 连接器参考