aws-sam-cli: `sam deploy` is slow to upload build artifacts to S3

Description:

When running sam deploy command, it seems to upload build artifacts to S3 at a fixed rate of ~230 KB/s, while the upload speed of my internet connection is capped at 2 MB/s. Although the stack region (US-EAST-1) is geographically quite far from my physical location, normal S3 upload speed doesn’t suffer as much compared to SAM. I’m working on a Golang project with several lambda functions and the upload takes a while to complete, delaying the process already slowed down by cfn.

Interestingly, when using sam sync --watch command, this slow upload only occurs when initially uploading the build artifacts. On subsequent changes to the code and resyncing, the upload speed is comparable to normal S3 upload speed.

Also, this is not a regression afaik. I’ve been facing this issue ever since I started working with sam (version 1.29). I thought this behavior was normal until I started using sam sync --watch.

Steps to reproduce:

  1. Run sam deploy for a Go project.
  2. Observe upload speed using windows task manager or any internet speed monitoring software.

Observed result:

Upload speed when uploading build artifacts: image

Upload speed when directly uploading to S3 from browser: image

Upload speed when running Amazon S3 Transfer Acceleration Speed Comparison tool: image

Expected result:

Upload speed of build artifacts should be comparable to normal S3 upload speed.

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

  1. OS: Windows 10
  2. sam --version: 1.58.0
  3. AWS region: US-EAST-1

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 19 (6 by maintainers)

Most upvoted comments

👍 to investing in improving this.

We’re an AWS Lambda Golang shop as well, and the developer experience is heinous.

We’ve even broken up our application into 8 different SAM template/applications and parallelized each of their sam build && sam package calls , but that doesn’t solve the glaring issue of painfully slow uploads.

I’m thinking it might be worth spending a week or two getting entirely off of SAM and Cloudformation - the temporary disruption to our developers will be nothing compared to how much time they’ll save once they have a proper devex.

Also encountering this, sam sync takes a couple of seconds to deploy my very minimal setup, while sam deploy can take multiple minutes.