aws / aws/aws-sam-cli

`sam deploy` is slow to upload build artifacts to S3

Open
#4,287 19 comments 0 reactions 0 assignees View on GitHub
area/deploy area/performance maintainer/need-followup
Dominant language
Python
Stars
6.7k
Forks
1.2k
Avg merge
1d 10h
Merged PRs (30d)
52

Description

### 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](https://user-images.githubusercontent.com/24279322/194585866-d28b289a-5f9c-4a1f-ada7-9817eba200df.png)

Upload speed when directly uploading to S3 from browser:
![image](https://user-images.githubusercontent.com/24279322/194590710-16cda220-315d-41c1-9255-30488269e483.png)

Upload speed when running [Amazon S3 Transfer Acceleration Speed Comparison tool](https://s3-accelerate-speedtest.s3-accelerate.amazonaws.com/en/accelerate-speed-comparsion.html):
![image](https://user-images.githubusercontent.com/24279322/194636184-150ad8c7-16eb-4ccd-aca5-74925cab2d04.png)

### 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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.