

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 在 AWS SAM 範本中定義應用程式資源
<a name="authoring-define-resources"></a>

您可以在 AWS SAM 範本的 `Resources`區段中定義無伺服器應用程式使用 AWS 的資源。當您定義資源時，您可以識別什麼是資源、它如何與其他資源互動，以及如何存取它 （即資源的許可）。

 AWS SAM 範本的 `Resources`區段可以包含 CloudFormation 資源和資源的組合 AWS SAM 。此外，您可以針對下列資源使用 AWS SAM的速記語法：


| AWS SAM 速記語法 | 它會如何處理相關 AWS 資源 | 
| --- | --- | 
| [AWS::Serverless::Api](sam-resource-api.md) | 建立可透過 HTTPS 端點叫用之 API Gateway 資源和方法的集合。 | 
| [AWS::Serverless::Application](sam-resource-application.md) | 將來自 [AWS Serverless Application Repository](https://serverlessrepo.aws.amazon.com/applications)或來自 Amazon S3 儲存貯體的無伺服器應用程式內嵌為巢狀應用程式。 | 
| [AWS::Serverless::Connector](sam-resource-connector.md) | 設定兩個資源之間的許可。如需連接器的簡介，請參閱 [使用 AWS SAM 連接器管理資源許可](managing-permissions-connectors.md)。 | 
| [AWS::Serverless::Function](sam-resource-function.md) | 建立觸發 AWS Lambda 函數的函數、 AWS Identity and Access Management (IAM) 執行角色和事件來源映射。 | 
| [AWS::Serverless::GraphQLApi](sam-resource-graphqlapi.md) | 會為您的無伺服器應用程式建立 AWS AppSync GraphQL和設定 API。 | 
| [AWS::Serverless::HttpApi](sam-resource-httpapi.md) | 建立 Amazon API Gateway HTTP API，可讓您建立比 REST API 更低延遲和成本的 RESTful APIs。 APIs  | 
| [AWS::Serverless::LayerVersion](sam-resource-layerversion.md) | 建立 Lambda LayerVersion，其中包含 Lambda 函數所需的程式庫或執行時間程式碼。 | 
| [AWS::Serverless::SimpleTable](sam-resource-simpletable.md) | 使用單一屬性主索引鍵建立 DynamoDB 資料表。 | 
| [AWS::Serverless::StateMachine](sam-resource-statemachine.md) | 建立 AWS Step Functions 狀態機器，您可以使用它來協調 AWS Lambda 函數和其他 AWS 資源，以形成複雜且強大的工作流程。 | 

上述資源也會列在 中[AWS SAM 資源和屬性](sam-specification-resources-and-properties.md)。

如需所有 AWS 資源和屬性類型 CloudFormation 和 AWS SAM 支援的參考資訊，請參閱*AWS CloudFormation 《 使用者指南》*中的[AWS 資源和屬性類型參考](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html)。