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β
| Name | Type | Description |
|---|---|---|
| region | string | AWS region to deploy the EFS filesystem |
| environment | string | Tag to specify the deployment environment (e.g., dev, staging, prod) |
| subnet_ids | list | List of subnet IDs where mount targets will be created |
| security_group_ids | list | List of security group IDs to attach to mount targets |
π€ Outputsβ
| Name | Description |
|---|---|
| efs_id | The ID of the created EFS filesystem |
| mount_target_ids | The list of EFS mount target IDs |
| efs_arn | The 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.