Skip to content

How to Start Using sam sync

Mehmet Nuri Deveci edited this page Oct 25, 2021 · 6 revisions

Disclaimer: This feature can change at any time based on customer and stakeholder feedback and prioritization activities.

Curious about the feature? Watch the video here.

We are targeting to release an installable public beta of new AWS SAM CLI features soon, but if you want to get your hands dirty, here is how to setup a local virtual environment to test these features.

For the simplicity, we will clone our projects into ~/sam-beta/ folder. Please feel free to change this directory if you prefer some other place.

  1. Create your project directory and move into it:
    • mkdir ~/sam-beta && cd ~/sam-beta
  2. Clone AWS SAM CLI repository into that directory and checkout accelerate branch:
    • git clone https://github.com/aws/aws-sam-cli.git && cd aws-sam-cli && git checkout accelerate
  3. Create a python virtual environment into that directory and activate it. Prefer using python3.8.
    • python -m venv .venv-beta && source .venv-beta/bin/activate
  4. Install development version of SAM CLI into newly created virtual environment;
    • make init
    • In order to confirm, you can run samdev --help and it should display newly created sam sync command there.

Optional: Use New Version of Lambda Builders

With the latest improvements in lambda builders, we now support Incremental build for supported runtimes (python, ruby, nodejs). For these runtimes, if you run sam build --cached it will check if dependencies have been changed, and if not it will use previously downloaded dependencies and update latest version of lambda function code.

So in order to use this new lambda builders with the development version of SAM CLI above;

  1. Activate previously created virtual environment, if you haven’t yet
    • cd ~/sam-beta && source .venv-beta/bin/activate
  2. Clone AWS Lambda Builders into your previously created workspace:
    • git clone https://github.com/aws/aws-lambda-builders.git && cd aws-lambda-builders
  3. Install lambda builders into current virtual environment
    • pip install -e .
  4. Update lambda builders version in SAM CLI
    • Go to folder where SAM CLI is cloned on your local machine
    • Open requiremenents/base.txt in previously cloned SAM CLI
    • Update aws_lambda_builders version to 1.9.0
    • Run make init
  5. Now samdev build --cached and samdev sync commands should be using incremental build.

Feedback/Comments?

If you have feedback or comments, please leave them in this tracking issue.

Clone this wiki locally