aws-amplify / aws-amplify/amplify-cli

Lambda functions as Docker Container Images

Open
#8,120 10 comments 48 reactions 0 assignees View on GitHub
feature-request functions p4
Dominant language
TypeScript
Stars
2.9k
Forks
825
Avg merge
11d 23h
Merged PRs (30d)
2

Description

### Is this related to a new or existing Amplify category?

function

### Is this related to another service?

ECS, Docker

### Describe the feature you'd like to request

As an engineer,
I want to create a Lambda function that is deployed in the form of a Docker container rather than in a dedicated runtime,
so that I have more flexibility, control, and fewer restrictions on the type of code that my function executes

More information on Lambda containers: https://docs.aws.amazon.com/lambda/latest/dg/images-create.html

**Fewer restrictions**

- File size limitations. 250MB seems like a pretty generous limit, however, when doing image processing you typically need to use dependencies that easily exceed this limit. Even basic NodeJS projects creep up to 100MB very quickly because of the various modules that one installs.

Lambdas using containers can be up to 10GB in size!

- Run time limitations. Some libraries need to be installed inside a specific runtime. Because I use MacOS these get installed with the wrong binaries causing my Lambda to fail when it starts up.

Lambdas using containers get around this problem since all packages will be installed using the same runtime that will execute the application.

### Describe the solution you'd like

When running `amplify add function` I'd like another option (i.e. provider) that lets me choose "Container Image". This will then create the right CF template with a basic Dockerfile and /src folder that I can then use to do what I need to do.

When running `amplify push` it will build the image, upload it to ECS with the correct tags and deploy the CF template using the new image tag.

When running `amplify remove` it will delete all assets locally, along with the ECS images and CF template.

### Describe alternatives you've considered

I'm investigating what it would take to build a custom function provider plugin based on how the python/nodeJS ones work. I can do this but will need some guidance/pointers from the Amplify team.

I've also looked at building something custom outside my amplify app, with a custom build pipeline, etc. This is NOT ideal since it's extra work - given I'm a 1 man team.

### Additional context

_No response_

### Is this something that you'd be interested in working on?

- [X] 👋 I may be able to implement this feature request
- [ ] ⚠️ This feature might incur a breaking change

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.