

# sam list resources
<a name="sam-cli-command-reference-sam-list-resources"></a>

This page provides reference information for the Amazon Serverless Application Model Command Line Interface (Amazon SAM CLI) `sam list resources` subcommand.

For an introduction to the Amazon SAM CLI, see [What is the Amazon SAM CLI?](what-is-sam-overview.md#what-is-sam-cli)

The `sam list resources` subcommand displays the resources in your Amazon Serverless Application Model (Amazon SAM) template that are created in Amazon CloudFormation by the Amazon SAM transform at deployment.

Use **sam list resources** with an Amazon SAM template before deployment to see resources that will be created. Provide an Amazon CloudFormation stack name to view a consolidated list that includes deployed resources.

**Note**  
To generate a list of resources from your Amazon SAM template, a local transform of your template is performed. Resources that will be deployed with conditions, such as within a specific region, are included in this list.

## Usage
<a name="sam-cli-command-reference-sam-list-resources-usage"></a>

```
$ sam list resources {{<options>}}
```

## Options
<a name="sam-cli-command-reference-sam-list-resources-options"></a>

`--config-env {{TEXT}}`  <a name="sam-cli-command-reference-sam-list-resources-options-config-env"></a>
The environment name specifying the default parameter values in the configuration file to use.  
*Default value*: `default`  
For more information about configuration files, see [Amazon SAM CLI configuration file](serverless-sam-cli-config.md).

`--config-file {{TEXT}}`  <a name="sam-cli-command-reference-sam-list-resources-options-config-file"></a>
The path and file name of the configuration file containing default parameter values to use.  
*Default value*: `samconfig.toml` in current working directory.  
For more information about configuration files, see [Amazon SAM CLI configuration file](serverless-sam-cli-config.md).

`--debug`  <a name="sam-cli-command-reference-sam-list-resources-options-debug"></a>
Turn on debug logging to print debug messages generated by the Amazon SAM CLI with timestamps.

`--help, -h`  <a name="sam-cli-command-reference-sam-list-resources-options-help"></a>
Show this message and exit.

`--output [json|table]`  <a name="sam-cli-command-reference-sam-list-resources-options-output"></a>
Specify the format to output results.  
*Default value*: `table`

`--profile {{TEXT}}`  <a name="sam-cli-command-reference-sam-list-resources-options-profile"></a>
Select a specific profile from your credential file to get Amazon credentials.

`--region {{TEXT}}`  <a name="sam-cli-command-reference-sam-list-resources-options-region"></a>
Set the Amazon region of the service. For example, `us-east-1`.

`--save-params`  <a name="sam-cli-command-reference-sam-list-resources-options-save-params"></a>
Save the parameters that you provide at the command line to the Amazon SAM configuration file.

`--stack-name {{TEXT}}`  <a name="sam-cli-command-reference-sam-list-resources-options-stack-name"></a>
Name of the deployed Amazon CloudFormation stack. The stack name can be found in your application's `samconfig.toml` file or designated configuration file.  
When provided, resource logical IDs from your template will be mapped to their corresponding physical IDs in Amazon CloudFormation. To learn more about physical IDs, see [ Resource fields](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/resources-section-structure.html#resources-section-structure-resource-fields) in the *Amazon CloudFormation User Guide*.  
When this option is not specified, local resources defined in your template will display.

`--template-file, --template, -t {{PATH}}`  <a name="sam-cli-command-reference-sam-list-resources-options-"></a>
Amazon SAM template file.  
*Default value*: `template.[yaml|yml|json]`

## Examples
<a name="sam-cli-command-reference-sam-list-resources-examples"></a>

Display an output, in table format, of local resources from your Amazon SAM template and deployed resources from your Amazon CloudFormation stack named `test-stack`. Run from the same directory as your local template.

```
$ sam list resources --stack-name test-stack --output table
			
-------------------------------------------------------------------------------------------------------------------------
Logical ID                                                   Physical ID
-------------------------------------------------------------------------------------------------------------------------
HelloWorldFunction                                           sam-app-test-list-HelloWorldFunction-H85Y7yIV7ZLq
HelloWorldFunctionHelloWorldPermissionProd                   sam-app-test-list-
                                                             HelloWorldFunctionHelloWorldPermissionProd-1QH7CPOCBL2IK
HelloWorldFunctionRole                                       sam-app-test-list-HelloWorldFunctionRole-SRJDMJ6F7F41
ServerlessRestApi                                            uj80uoe2o2
ServerlessRestApiDeployment47fc2d5f9d                        pncw5f
ServerlessRestApiProdStage                                   Prod
ServerlessRestApiDeploymentf5716dc08b                        -
-------------------------------------------------------------------------------------------------------------------------
```