

# Set up for deploying with the Amazon SAM CLI and Infrastructure Composer
<a name="other-services-cfn-sam-using"></a>

To deploy your application with Amazon SAM, you first need to install and access the Amazon CLI and the Amazon SAM CLI. The topics in this section provide details on doing this.

## Install the Amazon CLI
<a name="other-services-cfn-sam-prerequisites-aws"></a>

We recommend installing and setting up the Amazon CLI before installing the Amazon SAM CLI. For instructions, see [Install or update to the latest version of the Amazon CLI](https://docs.amazonaws.cn/cli/latest/userguide/getting-started-install.html) in the *Amazon Command Line Interface User Guide*.

**Note**  
After installing the Amazon CLI, you must configure Amazon credentials. To learn more, see [Quick setup](https://docs.amazonaws.cn/cli/latest/userguide/getting-started-quickstart.html) in the *Amazon Command Line Interface User Guide*.

## Install the Amazon SAM CLI
<a name="other-services-cfn-sam-prerequisites-sam"></a>

To install the Amazon SAM CLI, see [Installing the Amazon SAM CLI](https://docs.amazonaws.cn/serverless-application-model/latest/developerguide/install-sam-cli.html) in the *Amazon Serverless Application Model Developer Guide*.

## Access the Amazon SAM CLI
<a name="w2aac23c13c13"></a>

If you use Infrastructure Composer from the Amazon Web Services Management Console, you have the following options to use the Amazon SAM CLI.

**Activate local sync mode**  
With local sync mode, your project folder, including the Amazon SAM template, are automatically saved to your local machine. Infrastructure Composer structures your project directory in a way that Amazon SAM recognizes. You can run the Amazon SAM CLI from the root directory of your project.  
For more information about **local sync** mode, see [Locally sync and save your project in the Infrastructure Composer console](using-composer-project-local-sync.md).

**Export your template**  
You can export your template to your local machine. Then, run the Amazon SAM CLI from the parent folder that contains the template. You can also use the `--template-file` option with any Amazon SAM CLI command and provide the path to your template.

**Use Infrastructure Composer from the Amazon Toolkit for Visual Studio Code**  
You can use Infrastructure Composer from the Toolkit for VS Code to bring Infrastructure Composer to your local machine. Then, use Infrastructure Composer and the Amazon SAM CLI from VS Code.

## Next steps
<a name="w2aac23c13c15"></a>

To deploy your application, refer to [Use Infrastructure Composer with Amazon SAM to build and deploy](other-services-cfn-sam-examples-example1.md).