aws-amplify / amplify-hosting

AWS Amplify Hosting provides a Git-based workflow for deploying and hosting fullstack serverless web applications.
https://aws.amazon.com/amplify/hosting/
Apache License 2.0
457 stars 115 forks source link

Provide settings to increase the build instance capacity #654

Open shide1989 opened 4 years ago

shide1989 commented 4 years ago

Is your feature request related to a problem? Please describe. For now the build instances are hosts with 4 vCPU, and 7GB memory.

Describe the solution you'd like I'd like to be able to increase the CPU, Memory, and maybe other settings to decrease the build time of my project.

Additional context I'm working on a +1 year project, and so far the build time has increased since we added additional features/settings to our project. The build configuration has already been optimised, but the provisionning time and build time still takes 7 to 10 minutes.

ryanwilsonperkin commented 4 years ago

Would also love to see this, would be happy to pay more for larger build instance sizes. In CI our build runs in ~1 minute on a powerful server, in Amplify it runs in ~5 minutes. Being able to customize this would substantially speed up our deploys.

kevcam4891 commented 4 years ago

My Cypress tests in some cases are using too much memory when I launch more than one visit in a test function. I'm really needing more memory to run my tests how I'd like them to run.

mwarkentin commented 3 years ago

It seems like the build environment could be CodeBuild behind the scenes - it would be nice if some of these other instance types were available:

kevcam4891 commented 3 years ago

If only. I really hope they will improve on this front soon!

On Thu, May 13, 2021 at 1:43 PM Michael Warkentin @.***> wrote:

It seems like the build environment could be CodeBuild behind the scenes - it would be nice if some of these other instance types were available:

https://camo.githubusercontent.com/e129b62b72b350d94f631fd922ba440fc677374e6e70ca16d80650733797af43/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6d7761726b656e74696e2d736e6170732f4275696c645f656e7669726f6e6d656e745f636f6d707574655f74797065735f2d5f4157535f436f64654275696c645f323032312d30352d31335f31312d35322d30362e706e67

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/aws-amplify/amplify-console/issues/654#issuecomment-840720028, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABDPO5QGH7QSUZOEGNOLBZTTNQFTJANCNFSM4M3FWF2Q .

mwarkentin commented 3 years ago

@kevcam4891 yes, we'd also be happy to pay more for more CPU (ARM could be really interesting too..) to throw at our big webpack builds.

image
ShrutiC-git commented 3 years ago

Yes, would definitely like this feature to be supported. Currently, some of the webpack builds take 10+ minutes, and adding the ability to offload heavier builds to a compute-optimized machine would be really nice.

Mentioum commented 2 years ago

+1 I suppose the alternative is to eject and manage this elsewhere? Github actions maybe.

mitchconquer commented 2 years ago

+1 my deploy time is 30 minutes

eric-zhu-uw commented 2 years ago

+1 My deployments are failing because it consume all the memory on the machine.

wgins commented 2 years ago

+1 would love to control build instance size to speed up our build times

wgins commented 2 years ago

@mauerbac can you help with this one?

neoplastic commented 2 years ago

+1 We'd be happy to pay for extra resources to get things built quicker.

quangdatpham commented 2 years ago

+1 We would love to have control in instance type configuration. It takes a minute on my local, but 15mins on the pipeline.

Leandros commented 2 years ago

Has there been any official word on this? Our builds now take over 30 minutes.

danitul commented 2 years ago

Same for us. This would be much appreciated ! E2E tests take more than 30 minutes to run on amplify compared to about 15 minutes locally.

hnajera commented 2 years ago
kevcam4891 commented 2 years ago

At this point I'd settle for paying $$$ just to get a response from AWS.

tjohnwu commented 2 years ago

+1 would love faster deploys

soplan commented 2 years ago

+1 here. What I have done now is not to auto-update amplify CLI to latest version during deploy which is default behavior. This gives us 3 minutes back of build time.

mwarkentin commented 2 years ago

How do you do that?

mitchconquer commented 2 years ago

Yeah we're seeing 40-minute deployment times and it just keeps going up 😭

https://github.com/aws-amplify/amplify-cli/issues/9851

soplan commented 2 years ago

How do you do that?

  1. Amplify console
  2. Select project
  3. Build Settings
  4. scroll down "Build Image Settings"
  5. Delete Amplify CLI from "live update packages"
soplan commented 2 years ago

Yeah we're seeing 40-minute deployment times and it just keeps going up 😭

aws-amplify/amplify-cli#9851

Damn... and for that reason we stayed away from using Amplify to manage our backend deployments. We had long debates about to include backend in Amplify or not.. After 1 week of trialing we already entered in to some bumps and we felt this was not mature enough so we used serverless framework and CDK. We only use Amplify for CI/CD our frontend and that is going good 9 out of 10 times.

kondo-to commented 2 years ago

+1 I got such a error to build java Lambda function with graalVM for native-image. looks memory is not enough. now I gave up to use useful Amplify CI/CD flow and need to deploy it via Cloud9 manually for backend part.😢
I really hope this improvement.

2022-02-18T08:46:31.696Z [INFO]: Error: Command failed with exit code 1: gradle build
                                 ...
                                 Note: Creating bean classes for 1 type elements
                                 OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000006e9d00000, 1088946176, 0) failed; error='Not enough space' (errno=12)
                                 Error: Image build request failed with exit status 1

Thanks.

swaminator commented 2 years ago

We will be prioritizing this feature this year. Stay tuned..

kevcam4891 commented 2 years ago

Thank goodness! Hoping at the very least for this to be an update by the next re:invent!!

ymsrk commented 2 years ago

+1 would love to control build instance size

mylawacad commented 2 years ago

+1 Any update on this since Mar 2019?

kevcam4891 commented 2 years ago

@swaminator, any update on this enhancement and when we might expect it? Is this still a priority?

SamiHK commented 2 years ago

@swaminator, I am experiencing 100 mins build time, is this feature on cards, my project have gone massive and need to increase the provisions asap!

spignataro commented 2 years ago

Here is what I did to fix my issues:

Go to Environment variables and add the following:

Variable: NODE_OPTIONS Value: --max_old_space_size=4096

Variable: DISABLE_ESLINT_PLUGIN Value: true

Once you do that - your build should drop in time and deploy. Now go and enjoy your day.

I should mention our project is a react js project and this may not work for everyone - but the concept might be translatable.

kevcam4891 commented 1 year ago

Me waiting for this feature to release 😫💀

ospikovets commented 1 year ago

Are there any updates on this one?

My amplify build fails with running out of memory. Is there any workaround to increase provisioned memory for the build instance?

imtiazqumar commented 1 year ago

I am facing the same issue, i am building a react app and amplify frontend build is giving me this error

The build failed because the process exited too early. This probably means the system ran out of memory or someone called kill -9 on the process

Any recommendation on how to overcome this?

imtiazqumar commented 1 year ago

hello guys, for those who are still looking for a workaround. I have created a swap of around 4 GB and it resolved my memory issue. These are the exact commands i added in preBuild phase in my amplify.yml file

sudo fallocate -l 4G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
swapon -s
Hernanm0g commented 1 year ago

@imtiazqumar worked perfect for me, but without sudo...

phases:
    preBuild:
      commands:
        - export NODE_OPTIONS=--max-old-space-size=16384
        - fallocate -l 4G /swapfile
        - chmod 600 /swapfile
        - mkswap /swapfile
        - swapon /swapfile
        - swapon -s
claudechenth commented 1 year ago

Thanks @imtiazqumar @Hernanm0g Great solution! And no significant change in terms of building time for us!

rlejeune commented 1 year ago

We will be prioritizing this feature this year. Stay tuned..

Any news on this? @swaminator

gvnavin commented 1 year ago

Any updates on this ? We are also seeing this issue.

davidkircos commented 1 year ago

We are also running into this

Jordan-Eckowitz commented 1 year ago

We will be prioritizing this feature this year. Stay tuned..

This was promised over a year ago, any updates? Our builds are working with the fix above but its very slow.

davidkircos commented 1 year ago

We switched to Vercel. It is 4x faster for us...

yaelrabi commented 1 year ago

+1 would love to control build instance size

ash-77777 commented 1 year ago

@imtiazqumar worked perfect for me, but without sudo...

phases:
    preBuild:
      commands:
        - export NODE_OPTIONS=--max-old-space-size=16384
        - fallocate -l 4G /swapfile
        - chmod 600 /swapfile
        - mkswap /swapfile
        - swapon /swapfile
        - swapon -s

In case it helps somebody else in my situation I had to run these steps at the start of the build phase rather than preBuild to resolve my errors.

jengarciacalendly commented 10 months ago

@swaminator this has been an issue well over a year. Can you please advise on the fix time?

lucitemple commented 10 months ago

I am facing the same issue, i am building a react app and amplify frontend build is giving me this error

The build failed because the process exited too early. This probably means the system ran out of memory or someone called kill -9 on the process

I had to do two things to resolve 1) as per @Hernanm0g

phases:
    preBuild:
      commands:
        - fallocate -l 4G /swapfile
        - chmod 600 /swapfile
        - mkswap /swapfile
        - swapon /swapfile
        - swapon -s

2) Troubleshoot environmental variables, which were used by build script .

sho-pb commented 9 months ago

Hi! I encountered this when trying to deploy a Next.js + pnpm application. Is this issue working towards a solution?

albert-kovalevskij commented 9 months ago

@sho-pb I was getting an error trying to deploy monorepo Next.js app with turbo and pnpm and was getting error that container run out of memory, but then I encountered in the docs https://docs.aws.amazon.com/amplify/latest/userguide/monorepo-configuration.html for pnpm in .npmrc file node-linker=hoisted needs to be added, that worked for me

p-schneid commented 8 months ago

@albert-kovalevskij Your comment probably saved me a couple hours. Thank you!!

m-melis commented 7 months ago

@imtiazqumar worked perfect for me, but without sudo...

phases:
    preBuild:
      commands:
        - export NODE_OPTIONS=--max-old-space-size=16384
        - fallocate -l 4G /swapfile
        - chmod 600 /swapfile
        - mkswap /swapfile
        - swapon /swapfile
        - swapon -s

Unfortunately this solution doesn't work anymore with the newest Amazon Linux:2023 default build image (fallocate -l 4G /swapfile raises permission denied).

However, creating a custom-built image based on Amazon Linux:2023 still allows this workaround to be used (and also install node 18.18.2 if required). See https://github.com/aws-amplify/amplify-hosting/issues/3773#issuecomment-1797860643

An option to customize the build instance capacity is really needed.