Skip to main content

EFS Filesystem

πŸ“¦ Overview​

This Terraform module provisions a basic Amazon EFS (Elastic File System) setup with the following features:

It’s ideal for container workloads, shared EC2 volumes, and lift-and-shift legacy applications that require scalable, network-attached storage across multiple Availability Zones.


βœ… Key Features​

  • Provisions a single EFS filesystem for shared storage
  • Creates mount targets in each specified subnet
  • Accepts custom security groups for access control
  • Supports multi-AZ architecture
  • Tags resources by environment and name for clarity

πŸ’Ό Use Cases​

  • Persistent storage for container workloads (ECS, EKS)
  • Shared file storage between EC2 instances
  • Migrating legacy apps to AWS with file system dependencies
  • Mountable, multi-AZ NFS storage for enterprise workloads

πŸ“₯ Input Variables​

NameTypeDescription
regionstringAWS region to deploy the EFS filesystem
environmentstringTag to specify the deployment environment (e.g., dev, staging, prod)
subnet_idslistList of subnet IDs where mount targets will be created
security_group_idslistList of security group IDs to attach to mount targets

πŸ“€ Outputs​

NameDescription
efs_idThe ID of the created EFS filesystem
mount_target_idsThe list of EFS mount target IDs
efs_arnThe ARN of the created EFS filesystem

πŸš€ Deployment Readiness​

  • βœ… Compatible with Terraform 1.0+
  • βœ… Tested with AWS provider 5.x
  • πŸ§ͺ Requires existing VPC subnets and security groups

πŸ› οΈ Example Usage​

module "efs_filesystem" {
source = "git::ssh://git@github.com/archiphire/aws-level-1-modules.git//storage/efs-filesystem?ref=v1.0.0"

region = "us-east-1"
environment = "dev"
subnet_ids = ["subnet-abc123", "subnet-def456"]
security_group_ids = ["sg-1234567890abcdef0"]
}
terraform init
terraform plan
terraform apply

or

tofu init
tofu plan
tofu apply

🧹 Cleanup Options​

terraform destroy

or

tofu destroy

Manual Cleanup (recommended for production):

Unmount the EFS filesystem from all clients Manually delete the EFS filesystem via the AWS Console or CLI Remove associated mount targets and unused security groups

πŸ›‘οΈ Notes​

This is a Level 1 foundational storage module. For encryption or performance tuning, use:

efs-filesystem-encrypted efs-filesystem-performance

Or compose them into a Level 2 workload module for advanced use cases.

πŸ”’ Deployment Package Notice​

This module is part of the Level 1 AWS License Tier. To access the full deployment package and source code, subscribe to Archiphire.