How to reduce AWS Amplify DataStorage

0

I'm using Amplify to host and deploy a small website (55 MO).

I received an email saying this : Your AWS account has exceeded 85% of the usage limit for one or more AWS Free Tier-eligible services for the month of December.

I'm using 4.35083377 GigaByte on the free tier (5 GB limit)

I have no clue where that data is coming from and would like to know how to reduce it. Is there anywhere on the console where I could see this ?

Thank you

Phil
asked 2 years ago675 views
3 Answers
0

Hello Phil,

I'll be happy to assist you with this query related to AWS Amplify hosting limit.

From the email notification [*] you received, it appears this was triggered due to the default AWS Amplify Hosting pricing : "*With AWS Free Usage Tier, you can get started for free. Upon sign up, new AWS customers receive 1,000 build minutes per month for the build and deploy feature, and 15 GB served per month and 5 GB data storage per month *for the hosting feature."

Currently (i.e. as of 12 Dec, 2021) AWS Amplify console does not have a feature to visualize your front-end build size, however after further research you use the following remediation steps:

  1. Use existing tool-chain commands like yarn build to check build size of your app. See sample usage of yarn build command on an Angular application :
Initial Chunk Files | Names         |      Size
vendor.js           | vendor        |  14.33 MB
polyfills.js        | polyfills     | 128.88 kB
main.js             | main          |  55.13 kB
runtime.js          | runtime       |   6.15 kB
styles.css          | styles        | 437 bytes

                    | Initial Total |  14.52 MB
  1. Modularization
  • If you currently you use the existing Amplify JavaScript library (v2.x.x), you can reduce the bundle size of your application by upgrading to the new AWS Amplify JavaScript library (v3) has modularization improvements with support for tree shaking which help reduce the bundle size of your application.

This is how I import the Amplify module before optimize.

import Amplify from ‘aws-amplify’;

This is how I only import the submodules I need.

import Amplify from ‘@aws-amplify/core’;
import Auth from ‘@aws-amplify/auth’;

It is always a good habit to analyze the bundle size after the build. Then you will find un-optimized imports and libraries. Always try to import submodules only from the libraries needed within the project. You can use tools like “source-map-explorer” to analyze your build package.

Should you have any follow-up questions related to this reported issue feel free to let us know by clicking the comment button.


References :

[*] "Your AWS account has exceeded 85% of the usage limit for one or more AWS Free Tier-eligible services for the month of December."

AWS
syumaK
answered 2 years ago
0

Hi, thank you for your answer. Unfortunately, I still can't find the root cause. My build size is around 55 MO and on every deploy, the storage on Amplify increases (i'm at 4.3 GO now and I don't know how to fix this!) Any other idea ? Thank you

Phil
answered 2 years ago
0

I know it is late but hoping it helps. I finally got an answer from aws support. Link to my question for details

tldr; => use the aws cli to delete existing jobs. Even if they say they didn't produce artifacts, they did, and that is what is eating up storage space. I had 43 jobs (all of my code pushes for changes over the year) so I deleted all but the last 2 and now my usage is at around 50%. It does take a while for the dashboard to reflect the change (like days, not hours)

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions