

# Generated CloudFormation resources for AWS SAM
<a name="sam-specification-generated-resources"></a>

This section provides details on the CloudFormation resources that are created when AWS SAM processes your AWS template. The set of CloudFormation resources that AWS SAM generates differs depending on the scenarios you specify. A *scenario* is the combination of AWS SAM resources and properties specified in your template file. You can reference the generated CloudFormation resources elsewhere within your template file, similar to how you reference resources that you declare explicitly in your template file.

For example, if you specify an `AWS::Serverless::Function` resource in your AWS SAM template file, AWS SAM always generates an `AWS::Lambda::Function` base resource. If you also specify the optional `AutoPublishAlias` property, AWS SAM additionally generates `AWS::Lambda::Alias` and `AWS::Lambda::Version` resources.

This section lists the scenarios and the CloudFormation resources that they generate, and shows how to reference the generated CloudFormation resources in your AWS SAM template file.

## Referencing generated CloudFormation resources
<a name="sam-specification-generated-resources-referencing"></a>

You have two options for referencing generated CloudFormation resources within your AWS SAM template file, by `LogicalId` or by referenceable property.

### Referencing generated CloudFormation resources by LogicalId
<a name="sam-specification-generated-resources-referencing-logicalid"></a>

The CloudFormation resources that AWS SAM generates each have a `[LogicalId](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/resources-section-structure.html#resources-section-structure-logicalid)`, which is an alphanumeric (A-Z, a-z, 0-9) identifier that is unique within a template file. AWS SAM uses the `LogicalIds` of the AWS SAM resources in your template file to construct the `LogicalIds` of the CloudFormation resources it generates. You can use the `LogicalId` of a generated CloudFormation resource to access properties of that resource within your template file, just like you would for an CloudFormation resource that you have explicitly declared. For more information about `LogicalIds` in CloudFormation and AWS SAM templates, see [Resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/resources-section-structure.html) in the *AWS CloudFormation User Guide*.

**Note**  
The `LogicalIds` of some generated resources include a unique hash value to avoid namespace clashes. The `LogicalIds` of these resources are derived when the stack is created. You can retrieve them only after the stack has been created using the AWS Management Console, AWS CLI, or one of the AWS SDKs. We don't recommend referencing these resources by `LogicalId` because the hash values might change.

### Referencing generated CloudFormation resources by referenceable property
<a name="sam-specification-generated-resources-referencing-referenceable-property"></a>

For some generated resources, AWS SAM provides a referenceable property of the AWS SAM resource. You can use this property to reference a generated CloudFormation resource and its properties within your AWS SAM template file.

**Note**  
Not all generated CloudFormation resources have referenceable properties. For those resources, you must use the `LogicalId`.

## Generated CloudFormation resource scenarios
<a name="sam-specification-generated-resources-scenarios"></a>

The following table summarizes the AWS SAM resources and properties that make up the scenarios that generate CloudFormation resources. The topics in the **Scenarios** column provide details about the additional CloudFormation resources that AWS SAM generates for that scenario.


| AWS SAM resource | Base CloudFormation resource | Scenarios | 
| --- | --- | --- | 
| AWS::Serverless::Api  | [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html) |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-specification-generated-resources.html)  | 
| AWS::Serverless::Application  | [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-stack.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-stack.html) |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-specification-generated-resources.html)  | 
| AWS::Serverless::CapacityProvider  | [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-capacityprovider.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-capacityprovider.html) |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-specification-generated-resources.html)  | 
| AWS::Serverless::Function | [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html) |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-specification-generated-resources.html)  | 
| AWS::Serverless::HttpApi | [AWS::ApiGatewayV2::Api](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-api.html) |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-specification-generated-resources.html)  | 
| AWS::Serverless::LayerVersion  | [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-layerversion.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-layerversion.html) |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-specification-generated-resources.html)  | 
| AWS::Serverless::SimpleTable  | [AWS::DynamoDB::Table](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dynamodb-table.html) |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-specification-generated-resources.html)  | 
| AWS::Serverless::StateMachine  | [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-stepfunctions-statemachine.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-stepfunctions-statemachine.html) |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-specification-generated-resources.html)  | 

**Topics**
+ [

## Referencing generated CloudFormation resources
](#sam-specification-generated-resources-referencing)
+ [

## Generated CloudFormation resource scenarios
](#sam-specification-generated-resources-scenarios)
+ [

# CloudFormation resources generated when AWS::Serverless::Api is specified
](sam-specification-generated-resources-api.md)
+ [

# CloudFormation resources generated when AWS::Serverless::Application is specified
](sam-specification-generated-resources-application.md)
+ [

# CloudFormation resources generated when AWS::Serverless::CapacityProvider is specified
](sam-specification-generated-resources-capacityprovider.md)
+ [

# CloudFormation resources generated when you specify AWS::Serverless::Connector
](sam-specification-generated-resources-connector.md)
+ [

# CloudFormation resources generated when AWS::Serverless::Function is specified
](sam-specification-generated-resources-function.md)
+ [

# CloudFormation resources generated when AWS::Serverless::GraphQLApi is specified
](sam-specification-generated-resources-graphqlapi.md)
+ [

# CloudFormation resources generated when AWS::Serverless::HttpApi is specified
](sam-specification-generated-resources-httpapi.md)
+ [

# CloudFormation resources generated when AWS::Serverless::LayerVersion is specified
](sam-specification-generated-resources-layerversion.md)
+ [

# CloudFormation resources generated when AWS::Serverless::SimpleTable is specified
](sam-specification-generated-resources-simpletable.md)
+ [

# CloudFormation resources generated when AWS::Serverless::StateMachine is specified
](sam-specification-generated-resources-statemachine.md)

# CloudFormation resources generated when AWS::Serverless::Api is specified
<a name="sam-specification-generated-resources-api"></a>

When an `AWS::Serverless::Api` is specified, AWS Serverless Application Model (AWS SAM) always generates an `AWS::ApiGateway::RestApi` base CloudFormation resource. In addition, it also always generates an `AWS::ApiGateway::Stage` and an `AWS::ApiGateway::Deployment` resource.

**`AWS::ApiGateway::RestApi`**  
*`LogicalId`: *`<api‑LogicalId>`  
*Referenceable property: *N/A (you must use the `LogicalId` to reference this CloudFormation resource)

**`AWS::ApiGateway::Stage`**  
*`LogicalId`: *`<api‑LogicalId><stage‑name>Stage`  
`<stage‑name>` is the string that the `StageName` property is set to. For example, if you set `StageName` to `Gamma`, the `LogicalId` is `MyRestApiGammaStage`.  
*Referenceable property: *`<api‑LogicalId>.Stage`

**`AWS::ApiGateway::Deployment`**  
*`LogicalId`: *`<api‑LogicalId>Deployment<sha>`  
`<sha>` is a unique hash value that is generated when the stack is created. For example, `MyRestApiDeployment926eeb5ff1`.  
*Referenceable property: *`<api‑LogicalId>.Deployment`

In addition to these CloudFormation resources, when `AWS::Serverless::Api` is specified, AWS SAM generates additional CloudFormation resources for the following scenarios.

**Topics**
+ [

## DomainName property is specified
](#sam-specification-generated-resources-api-domain-name)
+ [

## UsagePlan property is specified
](#sam-specification-generated-resources-api-usage-plan)

## DomainName property is specified
<a name="sam-specification-generated-resources-api-domain-name"></a>

When the `DomainName` property of the `Domain` property of an `AWS::Serverless::Api` is specified, AWS SAM generates the `AWS::ApiGateway::DomainName` CloudFormation resource.

**`AWS::ApiGateway::DomainName`**  
*`LogicalId`: *`ApiGatewayDomainName<sha>`  
`<sha>` is a unique hash value that is generated when the stack is created. For example: `ApiGatewayDomainName926eeb5ff1`.  
*Referenceable property: *`<api‑LogicalId>.DomainName`

## UsagePlan property is specified
<a name="sam-specification-generated-resources-api-usage-plan"></a>

When the `UsagePlan` property of the `Auth` property of an `AWS::Serverless::Api` is specified, AWS SAM generates the following CloudFormation resources: `AWS::ApiGateway::UsagePlan`, `AWS::ApiGateway::UsagePlanKey`, and `AWS::ApiGateway::ApiKey`.

**`AWS::ApiGateway::UsagePlan`**  
*`LogicalId`: *`<api‑LogicalId>UsagePlan`  
*Referenceable property: *`<api‑LogicalId>.UsagePlan`

**`AWS::ApiGateway::UsagePlanKey`**  
*`LogicalId`: *`<api‑LogicalId>UsagePlanKey`  
*Referenceable property: *`<api‑LogicalId>.UsagePlanKey`

**`AWS::ApiGateway::ApiKey`**  
*`LogicalId`: *`<api‑LogicalId>ApiKey`  
*Referenceable property: *`<api‑LogicalId>.ApiKey`

# CloudFormation resources generated when AWS::Serverless::Application is specified
<a name="sam-specification-generated-resources-application"></a>

When an `AWS::Serverless::Application` is specified, AWS Serverless Application Model (AWS SAM) generates an `AWS::CloudFormation::Stack` base CloudFormation resource.

**`AWS::CloudFormation::Stack`**  
*`LogicalId`: *`<application‑LogicalId>`   
*Referenceable property: *N/A (you must use the `LogicalId` to reference this CloudFormation resource)

# CloudFormation resources generated when AWS::Serverless::CapacityProvider is specified
<a name="sam-specification-generated-resources-capacityprovider"></a>

When an `AWS::Serverless::CapacityProvider` is specified, AWS Serverless Application Model (AWS SAM) generates an `AWS::Lambda::CapacityProvider` base CloudFormation resource.

**`AWS::Lambda::CapacityProvider`**  
*`LogicalId`: *`<capacityprovider‑LogicalId>`  
*Referenceable property: *N/A (you must use the `LogicalId` to reference this CloudFormation resource)

In addition to this CloudFormation resource, when `AWS::Serverless::CapacityProvider` is specified, AWS SAM also generates CloudFormation resources for the following scenarios:

**Topics**
+ [

## OperatorRole property is not specified
](#sam-specification-generated-resources-capacityprovider-iam-role)

## OperatorRole property is not specified
<a name="sam-specification-generated-resources-capacityprovider-iam-role"></a>

When the `OperatorRole` property of an `AWS::Serverless::CapacityProvider` is *not* specified, AWS SAM generates an `AWS::IAM::Role` CloudFormation resource with the `AWSLambdaManagedEC2ResourceOperator` managed policy attached.

**`AWS::IAM::Role`**  
*`LogicalId`: *`<capacityprovider‑LogicalId>OperatorRole`  
*Referenceable property: *N/A (you must use the `LogicalId` to reference this CloudFormation resource)

# CloudFormation resources generated when you specify AWS::Serverless::Connector
<a name="sam-specification-generated-resources-connector"></a>

**Note**  
When you define connectors through the embedded `Connectors` property, it is first transformed into an `AWS::Serverless::Connector` resource before generating these resources.

When you specify an `AWS::Serverless::Connector` resource in an AWS SAM template, AWS SAM generates the following AWS CloudFormation resources as needed.

**`AWS::IAM::ManagedPolicy`**  
 *`LogicalId`:*`<connector‑LogicalId>Policy`   
 *Referenceable property:* N/A (To reference this CloudFormation resource, you must use the `LogicalId`.) 

**`AWS::SNS::TopicPolicy`**  
 *`LogicalId`:*`<connector‑LogicalId>TopicPolicy`   
 *Referenceable property:* N/A (To reference this CloudFormation resource, you must use the `LogicalId`.) 

**`AWS::SQS::QueuePolicy`**  
 *`LogicalId`:*`<connector‑LogicalId>QueuePolicy`   
 *Referenceable property:* N/A (To reference this CloudFormation resource, you must use the `LogicalId`.) 

**`AWS::Lambda::Permission`**  
 *`LogicalId`:*`<connector‑LogicalId><permission>LambdaPermission`   
 `<permission>` is a permission specified by the `Permissions` property. For example, `Write`.   
*Referenceable property:* N/A (To reference this CloudFormation resource, you must use the `LogicalId`.) 

# CloudFormation resources generated when AWS::Serverless::Function is specified
<a name="sam-specification-generated-resources-function"></a>

When an `AWS::Serverless::Function` is specified, AWS Serverless Application Model (AWS SAM) always creates an `AWS::Lambda::Function` base CloudFormation resource.

**`AWS::Lambda::Function`**  
*`LogicalId`: *`<function‑LogicalId>`  
*Referenceable property: *N/A (you must use the `LogicalId` to reference this CloudFormation resource)

In addition to this CloudFormation resource, when `AWS::Serverless::Function` is specified, AWS SAM also generates CloudFormation resources for the following scenarios.

**Topics**
+ [

## Core function properties
](#sam-specification-generated-resources-function-core-properties)
+ [

## Event sources
](#sam-specification-generated-resources-function-event-sources)
+ [

## Event configuration
](#sam-specification-generated-resources-function-event-configuration)

## Core function properties
<a name="sam-specification-generated-resources-function-core-properties"></a>

The following scenarios generate CloudFormation resources based on core function properties:

### Role property is not specified
<a name="sam-specification-generated-resources-function-not-role"></a>

When the `Role` property of an `AWS::Serverless::Function` is *not* specified, AWS SAM generates an `AWS::IAM::Role` CloudFormation resource.

**`AWS::IAM::Role`**  
*`LogicalId`: *`<function‑LogicalId>Role`  
*Referenceable property: *N/A (you must use the `LogicalId` to reference this CloudFormation resource)

### AutoPublishAlias property is specified
<a name="sam-specification-generated-resources-function-autopublishalias"></a>

When the `AutoPublishAlias` property of an `AWS::Serverless::Function` is specified, AWS SAM generates the following CloudFormation resources: `AWS::Lambda::Alias` and `AWS::Lambda::Version`.

**`AWS::Lambda::Alias`**  
*`LogicalId`: *`<function‑LogicalId>Alias<alias‑name>`  
`<alias‑name>` is the string that `AutoPublishAlias` is set to. For example, if you set `AutoPublishAlias` to `live`, the `LogicalId` is: *MyFunction*Alias*live*.  
*Referenceable property: *`<function‑LogicalId>.Alias`

**`AWS::Lambda::Version`**  
*`LogicalId`: *`<function‑LogicalId>Version<sha>`  
`<sha>` is a unique hash value that is generated when the stack is created. For example, *MyFunction*Version*926eeb5ff1*.  
*Referenceable property: *`<function‑LogicalId>.Version`

For additional information on the `AutoPublishAlias` property, see the [Properties section of AWS::Serverless::Function](sam-resource-function.md#sam-resource-function-properties).

### DeploymentPreference property is specified
<a name="sam-specification-generated-resources-function-deploymentpreference"></a>

When the `DeploymentPreference` property of an `AWS::Serverless::Function` is specified, AWS SAM generates the following resources CloudFormation resources: `AWS::CodeDeploy::Application` and `AWS::CodeDeploy::DeploymentGroup`. In addition, if the `Role` property of the `DeploymentPreference` object is *not* specified, AWS SAM also generates an `AWS::IAM::Role` CloudFormation resource.

**`AWS::CodeDeploy::Application`**  
*`LogicalId`: *`ServerlessDeploymentApplication`  
*Referenceable property: *N/A (you must use the `LogicalId` to reference this CloudFormation resource)

**`AWS::CodeDeploy::DeploymentGroup`**  
*`LogicalId`: *`<function‑LogicalId>DeploymentGroup`  
*Referenceable property: *N/A (you must use the `LogicalId` to reference this CloudFormation resource)

**`AWS::IAM::Role`**  
*`LogicalId`: *`CodeDeployServiceRole`  
*Referenceable property: *N/A (you must use the `LogicalId` to reference this CloudFormation resource)

### FunctionUrlConfig property is specified
<a name="sam-specification-generated-resources-function-functionurlconfig"></a>

When the `FunctionUrlConfig` property is specified, AWS SAM generates different CloudFormation resources based on the `AuthType`.

When `AuthType: NONE` is specified, AWS SAM generates the following CloudFormation resources:

**`AWS::Lambda::Permission` (Invoke Access)**  
*`LogicalId`: *`<function‑LogicalId>URLInvokeAllowPublicAccess`  
*Referenceable property: *N/A (you must use the `LogicalId` to reference this CloudFormation resource)

**`AWS::Lambda::Permission` (Public Access)**  
*`LogicalId`: *`<function‑LogicalId>UrlPublicPermissions`  
*Referenceable property: *N/A (you must use the `LogicalId` to reference this CloudFormation resource)

**`AWS::Lambda::Url`**  
*`LogicalId`: *`<function‑LogicalId>Url`  
*Referenceable property: *N/A (you must use the `LogicalId` to reference this CloudFormation resource)

When `AuthType: AWS_IAM` is specified, AWS SAM generates only:

**`AWS::Lambda::Url`**  
*`LogicalId`: *`<function‑LogicalId>Url`  
*Referenceable property: *N/A (you must use the `LogicalId` to reference this CloudFormation resource)

For additional information on the `FunctionUrlConfig` property, see [FunctionUrlConfig](sam-property-function-functionurlconfig.md).

## Event sources
<a name="sam-specification-generated-resources-function-event-sources"></a>

The following scenarios generate CloudFormation resources based on event sources:

### An Api event source is specified
<a name="sam-specification-generated-resources-function-api"></a>

When the `Event` property of an `AWS::Serverless::Function` is set to `Api`, but the `RestApiId` property is *not* specified, AWS SAM generates the `AWS::ApiGateway::RestApi` CloudFormation resource.

**`AWS::ApiGateway::RestApi`**  
*`LogicalId`: *`ServerlessRestApi`  
*Referenceable property: *N/A (you must use the `LogicalId` to reference this CloudFormation resource)

### An HttpApi event source is specified
<a name="sam-specification-generated-resources-function-httpapi"></a>

When the `Event` property of an `AWS::Serverless::Function` is set to `HttpApi`, but the `ApiId` property is *not* specified, AWS SAM generates the `AWS::ApiGatewayV2::Api` CloudFormation resource.

**`AWS::ApiGatewayV2::Api`**  
*`LogicalId`: *`ServerlessHttpApi`  
*Referenceable property: *N/A (you must use the `LogicalId` to reference this CloudFormation resource)

### A streaming event source is specified
<a name="sam-specification-generated-resources-function-streaming"></a>

When the `Event` property of an `AWS::Serverless::Function` is set to one of the streaming types, AWS SAM generates the `AWS::Lambda::EventSourceMapping` CloudFormation resource. This applies to the following types: `DynamoDB`, `Kinesis`, `MQ`, `MSK`, and `SQS`.

**`AWS::Lambda::EventSourceMapping`**  
*`LogicalId`: *`<function‑LogicalId><event‑LogicalId>`  
*Referenceable property: *N/A (you must use the `LogicalId` to reference this CloudFormation resource)

### An event bridge (or event bus) event source is specified
<a name="sam-specification-generated-resources-function-eventbridge"></a>

When the `Event` property of an `AWS::Serverless::Function` is set to one of the event bridge (or event bus) types, AWS SAM generates the `AWS::Events::Rule` CloudFormation resource. This applies to the following types: `EventBridgeRule`, `Schedule`, and `CloudWatchEvents`.

**`AWS::Events::Rule`**  
*`LogicalId`: *`<function‑LogicalId><event‑LogicalId>`  
*Referenceable property: *N/A (you must use the `LogicalId` to reference this CloudFormation resource)

### An IotRule event source is specified
<a name="sam-specification-generated-resources-function-iotrule"></a>

When the `Event` property of an `AWS::Serverless::Function` is set to IoTRule, AWS SAM generates the `AWS::IoT::TopicRule` CloudFormation resource.

**`AWS::IoT::TopicRule`**  
*`LogicalId`: *`<function‑LogicalId><event‑LogicalId>`  
*Referenceable property: *N/A (you must use the `LogicalId` to reference this CloudFormation resource)

## Event configuration
<a name="sam-specification-generated-resources-function-event-configuration"></a>

The following scenarios generate CloudFormation resources based on event configuration:

### OnSuccess (or OnFailure) property is specified for Amazon SNS events
<a name="sam-specification-generated-resources-function-sns-onsuccess"></a>

When the `OnSuccess` (or `OnFailure`) property of the `DestinationConfig` property of the `EventInvokeConfig` property of an `AWS::Serverless::Function` is specified, and the destination type is `SNS` but the destination ARN is *not* specified, AWS SAM generates the following CloudFormation resources: `AWS::Lambda::EventInvokeConfig` and `AWS::SNS::Topic`.

**`AWS::Lambda::EventInvokeConfig`**  
*`LogicalId`: *`<function‑LogicalId>EventInvokeConfig`  
*Referenceable property: *N/A (you must use the `LogicalId` to reference this CloudFormation resource)

**`AWS::SNS::Topic`**  
*`LogicalId`: *`<function‑LogicalId>OnSuccessTopic` (or `<function‑LogicalId>OnFailureTopic`)  
*Referenceable property: *`<function‑LogicalId>.DestinationTopic`  
If both `OnSuccess` and `OnFailure` are specified for an Amazon SNS event, to distinguish between the generated resources, you must use the `LogicalId`.

### OnSuccess (or OnFailure) property is specified for Amazon SQS events
<a name="sam-specification-generated-resources-function-sqs-onsuccess"></a>

When the `OnSuccess` (or `OnFailure`) property of the `DestinationConfig` property of the `EventInvokeConfig` property of an `AWS::Serverless::Function` is specified, and the destination type is `SQS` but the destination ARN is *not* specified, AWS SAM generates the following CloudFormation resources: `AWS::Lambda::EventInvokeConfig` and `AWS::SQS::Queue`.

**`AWS::Lambda::EventInvokeConfig`**  
*`LogicalId`: *`<function‑LogicalId>EventInvokeConfig`  
*Referenceable property: *N/A (you must use the `LogicalId` to reference this CloudFormation resource)

**`AWS::SQS::Queue`**  
*`LogicalId`: *`<function‑LogicalId>OnSuccessQueue` (or `<function‑LogicalId>OnFailureQueue`)  
*Referenceable property: *`<function‑LogicalId>.DestinationQueue`  
If both `OnSuccess` and `OnFailure` are specified for an Amazon SQS event, to distinguish between the generated resources, you must use the `LogicalId`.

# CloudFormation resources generated when AWS::Serverless::GraphQLApi is specified
<a name="sam-specification-generated-resources-graphqlapi"></a>

When you specify an `AWS::Serverless::GraphQLApi` resource in an AWS Serverless Application Model (AWS SAM) template, AWS SAM always creates the following base AWS CloudFormation resources.

**`AWS::AppSync::DataSource`**  
*`LogicalId`: *`<graphqlapi-LogicalId><datasource-RelativeId><datasource-Type>DataSource`  
*Referenceable property: *N/A (you must use the `LogicalId` to reference this CloudFormation resource)

**`AWS::AppSync::FunctionConfiguration`**  
*`LogicalId`: *`<graphqlapi-LogicalId><function-RelativeId>`  
*Referenceable property: *N/A (you must use the `LogicalId` to reference this CloudFormation resource)

**`AWS::AppSync::GraphQLApi`**  
*`LogicalId`: *`<graphqlapi-LogicalId>`  
*Referenceable property: *N/A (you must use the `LogicalId` to reference this CloudFormation resource)

**`AWS::AppSync::GraphQLSchema`**  
*`LogicalId`: *`<graphqlapi-LogicalId>Schema`  
*Referenceable property: *N/A (you must use the `LogicalId` to reference this CloudFormation resource)

**`AWS::AppSync::Resolver`**  
*`LogicalId`: *`<graphqlapi-LogicalId><OperationType><resolver-RelativeId>`  
*Referenceable property: *N/A (you must use the `LogicalId` to reference this CloudFormation resource)

In addition to these CloudFormation resources, when `AWS::Serverless::GraphQLApi` is specified, AWS SAM may also generate the following CloudFormation resources.

`AWS::AppSync::ApiCache`  
*`LogicalId`: *`<graphqlapi-LogicalId>ApiCache`  
*Referenceable property: *N/A (you must use the `LogicalId` to reference this CloudFormation resource)

`AWS::AppSync::ApiKey`  
*`LogicalId`: *`<graphqlapi-LogicalId><apikey-RelativeId>`  
*Referenceable property: *N/A (you must use the `LogicalId` to reference this CloudFormation resource)

`AWS::AppSync::DomainName`  
*`LogicalId`: *`<graphqlapi-LogicalId>DomainName`  
*Referenceable property: *N/A (you must use the `LogicalId` to reference this CloudFormation resource)

`AWS::AppSync::DomainNameApiAssociation`  
*`LogicalId`: *`<graphqlapi-LogicalId>DomainNameApiAssociation`  
*Referenceable property: *N/A (you must use the `LogicalId` to reference this CloudFormation resource)

AWS SAM may also use the `AWS::Serverless::Connector` resource to provision permissions. For more information, see [CloudFormation resources generated when you specify AWS::Serverless::Connector](sam-specification-generated-resources-connector.md).

# CloudFormation resources generated when AWS::Serverless::HttpApi is specified
<a name="sam-specification-generated-resources-httpapi"></a>

When an `AWS::Serverless::HttpApi` is specified, AWS Serverless Application Model (AWS SAM) generates an `AWS::ApiGatewayV2::Api` base CloudFormation resource.

**`AWS::ApiGatewayV2::Api`**  
*`LogicalId`: *`<httpapi‑LogicalId>`  
*Referenceable property: *N/A (you must use the `LogicalId` to reference this CloudFormation resource)

In addition to this CloudFormation resource, when `AWS::Serverless::HttpApi` is specified, AWS SAM also generates CloudFormation resources for the following scenarios:

**Topics**
+ [

## StageName property is specified
](#sam-specification-generated-resources-httpapi-stage-name)
+ [

## StageName property is *not* specified
](#sam-specification-generated-resources-httpapi-not-stage-name)
+ [

## DomainName property is specified
](#sam-specification-generated-resources-httpapi-domain-name)

## StageName property is specified
<a name="sam-specification-generated-resources-httpapi-stage-name"></a>

When the `StageName` property of an `AWS::Serverless::HttpApi` is specified, AWS SAM generates the `AWS::ApiGatewayV2::Stage` CloudFormation resource.

**`AWS::ApiGatewayV2::Stage`**  
*`LogicalId`: *`<httpapi‑LogicalId><stage‑name>Stage`  
`<stage‑name>` is the string that the `StageName` property is set to. For example, if you set `StageName` to `Gamma`, the `LogicalId` is: *MyHttpApiGamma*Stage.  
*Referenceable property: *`<httpapi‑LogicalId>.Stage`

## StageName property is *not* specified
<a name="sam-specification-generated-resources-httpapi-not-stage-name"></a>

When the `StageName` property of an `AWS::Serverless::HttpApi` is *not* specified, AWS SAM generates the `AWS::ApiGatewayV2::Stage` CloudFormation resource.

**`AWS::ApiGatewayV2::Stage`**  
*`LogicalId`: *`<httpapi‑LogicalId>ApiGatewayDefaultStage`  
*Referenceable property: *`<httpapi‑LogicalId>.Stage`

## DomainName property is specified
<a name="sam-specification-generated-resources-httpapi-domain-name"></a>

When the `DomainName` property of the `Domain` property of an `AWS::Serverless::HttpApi` is specified, AWS SAM generates the `AWS::ApiGatewayV2::DomainName` CloudFormation resource.

**`AWS::ApiGatewayV2::DomainName`**  
*`LogicalId`: *`ApiGatewayDomainNameV2<sha>`  
`<sha>` is a unique hash value that is generated when the stack is created. For example, `ApiGatewayDomainNameV2`*926eeb5ff1*.  
*Referenceable property: *`<httpapi‑LogicalId>.DomainName`

# CloudFormation resources generated when AWS::Serverless::LayerVersion is specified
<a name="sam-specification-generated-resources-layerversion"></a>

When an `AWS::Serverless::LayerVersion` is specified, AWS Serverless Application Model (AWS SAM) generates an `AWS::Lambda::LayerVersion` base CloudFormation resource.

**`AWS::Lambda::LayerVersion`**  
*`LogicalId`: *`<layerversion‑LogicalId>`   
*Referenceable property: *N/A (you must use the `LogicalId` to reference this CloudFormation resource)

# CloudFormation resources generated when AWS::Serverless::SimpleTable is specified
<a name="sam-specification-generated-resources-simpletable"></a>

When an `AWS::Serverless::SimpleTable` is specified, AWS Serverless Application Model (AWS SAM) generates an `AWS::DynamoDB::Table` base CloudFormation resource.

**`AWS::DynamoDB::Table`**  
*`LogicalId`: *`<simpletable‑LogicalId>`   
*Referenceable property: *N/A (you must use the `LogicalId` to reference this CloudFormation resource)

# CloudFormation resources generated when AWS::Serverless::StateMachine is specified
<a name="sam-specification-generated-resources-statemachine"></a>

When an `AWS::Serverless::StateMachine` is specified, AWS Serverless Application Model (AWS SAM) generates an `AWS::StepFunctions::StateMachine` base CloudFormation resource.

**`AWS::StepFunctions::StateMachine`**  
*`LogicalId`: *`<statemachine‑LogicalId>`  
*Referenceable property: *N/A (you must use the `LogicalId` to reference this CloudFormation resource)

In addition to this CloudFormation resource, when `AWS::Serverless::StateMachine` is specified, AWS SAM also generates CloudFormation resources for the following scenarios:

**Topics**
+ [

## Role property is not specified
](#sam-specification-generated-resources-statemachine-not-role)
+ [

## An API event source is specified
](#sam-specification-generated-resources-statemachine-api)
+ [

## An event bridge (or event bus) event source is specified
](#sam-specification-generated-resources-statemachine-eventbridge)

## Role property is not specified
<a name="sam-specification-generated-resources-statemachine-not-role"></a>

When the `Role` property of an `AWS::Serverless::StateMachine` is *not* specified, AWS SAM generates an `AWS::IAM::Role` CloudFormation resource.

**`AWS::IAM::Role`**  
*`LogicalId`: *`<statemachine‑LogicalId>Role`  
*Referenceable property: *N/A (you must use the `LogicalId` to reference this CloudFormation resource)

## An API event source is specified
<a name="sam-specification-generated-resources-statemachine-api"></a>

When the `Event` property of an `AWS::Serverless::StateMachine` is set to `Api`, but the `RestApiId` property is *not* specified, AWS SAM generates the `AWS::ApiGateway::RestApi` CloudFormation resource.

**`AWS::ApiGateway::RestApi`**  
*`LogicalId`: *`ServerlessRestApi`  
*Referenceable property: *N/A (you must use the `LogicalId` to reference this CloudFormation resource)

## An event bridge (or event bus) event source is specified
<a name="sam-specification-generated-resources-statemachine-eventbridge"></a>

When the `Event` property of an `AWS::Serverless::StateMachine` is set to one of the event bridge (or event bus) types, AWS SAM generates the `AWS::Events::Rule` CloudFormation resource. This applies to the following types: `EventBridgeRule`, `Schedule`, and `CloudWatchEvents`.

**`AWS::Events::Rule`**  
*`LogicalId`: *`<statemachine‑LogicalId><event‑LogicalId>`  
*Referenceable property: *N/A (you must use the `LogicalId` to reference this CloudFormation resource)