- Newest
- Most votes
- Most comments
The issue you're experiencing with your NestJS application's disk storage healthcheck on AWS App Runner is not uncommon, and there are a few important considerations to keep in mind.
First, it's important to understand that App Runner provides a containerized environment with limited storage capacity, as you correctly noted. The default storage capacity in App Runner is indeed 3GB, which is relatively small and can easily be consumed by your application, its dependencies, and any temporary files generated during runtime.
Given this constraint, using a percentage-based threshold for disk usage (like 75%) may not be the most suitable approach for App Runner. Your application is likely consuming a significant portion of the available disk space just by being deployed, which is why the healthcheck is failing frequently.
Instead of using a percentage-based threshold, you have a few options to consider:
-
Adjust the threshold: You could increase the percentage threshold significantly, perhaps to 90% or 95%. However, this might not be ideal as it doesn't leave much room for temporary files or logs.
-
Use absolute values: As you suggested, you could switch to checking against an absolute value instead of a percentage. For example, you could set the check to fail if less than 500MB of free space is available.
-
Reconsider the necessity of the check: In a containerized environment like App Runner, disk space checks may not be as critical as they are in traditional server environments. App Runner manages the underlying infrastructure, and your application is designed to be stateless. You might consider removing this particular healthcheck altogether if it's not essential for your application's core functionality.
-
Monitor at the service level: Instead of implementing the disk space check within your application, you could rely on App Runner's built-in health checks and monitoring capabilities. App Runner provides its own health check mechanism that can detect if your application is running properly.
-
Use external storage: If your application needs to store or process large amounts of data, consider using external storage solutions like Amazon S3 for file storage or Amazon EFS for a filesystem that can be mounted to your App Runner service.
Ultimately, the best approach depends on your specific use case and requirements. If you decide to keep a disk space check, adjusting it to use absolute values rather than percentages would likely be the most straightforward solution for an App Runner environment. However, carefully consider whether this check is necessary given the managed nature of the App Runner service.
Remember, in containerized environments, it's generally more important to focus on the application's ability to handle requests and process data efficiently rather than monitoring system-level metrics like disk space, which are typically managed by the platform itself.
Sources
Configuring health checks for your service - AWS App Runner
HealthCheckConfiguration - AWS App Runner
Relevant content
asked 4 years ago

That does make sense, thanks. The way the NestJS storage checks work is with thresholds so if I set a static value like 3GB, it will fail if more than 3GB is consumed by the file system. So if I were to go the route of leaving this healthcheck in place, 3GB would be the correct value to set as the threshold?