Skip to content

EFS cost per Folder

0

Dear everyone, I would like to ask you if there is a way to calculate the EFS Costs (storage and access) per higher level directory. In essence, I have a directory tree that has has

/efs_mount/path/sub_dir1/.../
/efs_mount/path/sub_dir1/.../
/efs_mount/path/sub_dir1/.../

And each of those sub_dirX has multiple files and folders. Some of those are in the IA and others in Standard.

Is it possible to have the EFS cost per sub_dirX ?

Thank you so much everyone. Best A

asked 2 years ago911 views

3 Answers
1

Unfortunately, Amazon EFS does not provide a built-in way to calculate costs per individual directory or folder within your file system. EFS pricing is based on the total amount of data stored across the entire file system, regardless of the directory structure.

EFS charges are calculated based on the following factors:

  1. The amount of data stored in each storage class (Standard, Infrequent Access, and Archive)
  2. Data access charges for files in Infrequent Access (IA) or Archive storage
  3. Data transitions between storage classes using lifecycle management

While you can't get direct cost breakdowns per folder from EFS, you could potentially create a custom solution to estimate costs for specific directories:

  1. Use tools or scripts to analyze the contents of each sub_dirX, determining the total size of files and their storage classes.

  2. Calculate an estimate based on the current EFS pricing for each storage class and the data access patterns for files in IA or Archive storage.

  3. For more accurate results, you might need to monitor file access patterns over time, especially for files in IA or Archive storage, as there are additional charges for accessing these files.

  4. Keep in mind that EFS has minimum billing charges for files in IA and Archive storage classes (128 KiB per file), so very small files may incur higher costs than their actual size.

  5. Consider using AWS Cost Explorer or creating custom CloudWatch metrics to track overall EFS usage and costs, which could help in estimating costs for specific directories based on their proportion of total storage used.

While this approach can provide estimates, it won't be as precise as having native per-directory cost reporting. The actual EFS billing will still be based on the aggregate usage across the entire file system.
Sources
Features of Amazon EFS - Amazon Elastic File System
How Amazon EFS reports file system and object sizes - Amazon Elastic File System

answered 2 years ago

EXPERT

reviewed 2 years ago

EXPERT

reviewed 2 years ago

  • Hi, Can you explain how to monitor file access patterns at subfolder/subdirectory level in CloudWatch (or with any other tool? (cf. step 3 in the custom solution from your comment).

1

Hi,

The simplest ways to obtain what you want is to use Linux du from an EC2 Linux instance that has your EFS drive (it's regular NFS underneath) mounted in its own filesystem. du has all the options that you need to compute global usage, per directory, etc.

See https://www.geeksforgeeks.org/du-command-linux-examples/ for some usage examples.

Then you'll have to apply the EFS pricing for storage on those disk storage amounts.

Best,

Didier

EXPERT

answered 2 years ago

EXPERT

reviewed 2 years ago

0

Here is an approach you might want take take:

  1. Enable EFS File System Metrics: First, you need to enable EFS file system metrics in the AWS Management Console. This will allow you to monitor and retrieve usage and cost data for your EFS file system.

    • Go to the EFS service in the AWS Management Console.
    • Select your EFS file system and enable CloudWatch metrics for it.
  2. Use AWS Cost Explorer: Once the metrics are enabled, you can use AWS Cost Explorer to view the EFS usage and costs at a more granular level.

    • In the AWS Management Console, navigate to the Cost Explorer service.
    • Create a cost report that filters by the EFS file system and the different directories/subdirectories.
    • The report will show you the storage and data access costs for each directory/subdirectory within your EFS file system.
  3. Custom Cost Allocation: If you need more detailed cost information or the ability to generate reports outside of the AWS Cost Explorer, you can implement a custom cost allocation solution.

    • Use the AWS CloudWatch API to retrieve the usage metrics for your EFS file system, including the per-directory storage and access data.
    • Develop a script or application that processes the CloudWatch data and calculates the costs for each directory/subdirectory based on the current EFS pricing.
    • You can then integrate this custom cost allocation solution into your own reporting or cost management processes.

Keep in mind that the granularity of the cost data will depend on the level of detail captured by the EFS file system metrics. If you have a large number of subdirectories, the cost allocation process may become more complex.

Additionally, consider the potential performance impact of frequently querying the CloudWatch API or processing large amounts of usage data. You may need to optimize your cost allocation solution to ensure it doesn't significantly impact your application's performance.

answered 2 years ago

  • Hi Roy, Which CloudWatch metric did you enable to calculate cost per subdirectory? I don't get to this level of detail neither in CloudWatch nor Cost Explorer. Thanks!

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.