Laravel Vapor - Your application exceeds the maximum size allowed by AWS Lambda

By Hardik Savani November 5, 2023 Category : Laravel

This article will give you example of laravel vapor your application exceeds the maximum size allowed by aws lambda. this example will help you your application exceeds the maximum size allowed by aws lambda laravel vapor project. We will use laravel vapor exceeds the maximum size allowed by AWS Lambda. I’m going to show you about laravel vapor your application exceeds the maximum size allowed by aws lambda.

Yesterday i was working on my laravel app and i installed 3 new composer packages, then i just deploy it i got error "Your application exceeds the maximum size allowed by AWS Lambda" as bellow screenshot. i used runtime php8, but now i need to change that. so i used docker base deployment. just follow bellow step to make it done.

i found solution to use docker based deployment. aws server provide 50MB storage so you can not do it more then that. so you can do it using docker based deployment.

Do it as like bellow:

Install Docker

first you need to install docker in your system. you can follow bellow link to install docker in your OS.

https://docs.docker.com/engine/install/

If you are using ubuntu then follow bellow step here:

sudo apt-get update

sudo apt-get install \

apt-transport-https \

ca-certificates \

curl \

gnupg \

lsb-release

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

echo \

"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \

$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

sudo apt-get update

sudo apt-get install docker-ce docker-ce-cli containerd.io

apt-cache madison docker-ce

Configure vapor.yml File

after installed docker successfully. you need to configure your docker file and vapor.yml file as bellow:

There will be two files for docker configuration, one for staging and another for production as bellow:

production.Dockerfile

FROM laravelphp/vapor:php80

COPY . /var/task

staging.Dockerfile

FROM laravelphp/vapor:php80

COPY . /var/task

Set runtime option "docker" as bellow file.

vapor.yml

id: 22442

name: itsolutionstuff-vapor

environments:

production:

memory: 1024

cli-memory: 512

runtime: docker

build:

- 'COMPOSER_MIRROR_PATH_REPOS=1 composer install --no-dev'

staging:

memory: 1024

cli-memory: 512

runtime: docker

database: itsolutionstuff-vapor-staging

storage: itsolutionstuff-s3-files

build:

- 'COMPOSER_MIRROR_PATH_REPOS=1 composer install'

now just deploy it.

php vendor/bin/vapor deploy

i will works. i hope it can help you...

Tags :
Shares