EFS is a great tool, but lacks the simple capability of setting quotas. This little project solves that in a simple way by just checking the size of the file system, and optionally checking the size for each user. If any exceed a given quota, emails are sent out.
Type in check-sizes -h
to get a list of options for the CLI.
Example:
check-size --efs-name ATMO-prod --max-size 2048 --from-email from@moz --to-email to@moz --efs-dir /Users/frankbertsch/repos/sandbox/test/ --max-user-size 100 --email-users
This would:
-
Check if the EFS File System size exceeds 2KB, and email
to@moz
fromfrom@moz
if so -
Assume the file system is mounted at
/Users/frankbertsch/repos/sandbox/test
-
Check for any user accounts at 1 level deep, and if they exceed 100B, emails the User from
from@moz
Note: This assumes the directory name is the user email -
Email
to@moz
fromfrom@moz
about all user accounts that exceed the quota of 100B
The error botocore.exceptions.NoRegionError: You must specify a region.
can be resolved by running the following:
export AWS_DEFAULT_REGION=us-west-2
The resource you are running this on (ec2, presumably) needs access to the EFS resource. Create a policy with DescribeFileSystems
access and attach it to the ARN or role of the instance you are running on.
Run with --dry-run
to print out emails that would be sent.