Skip to main content

EFS Filesystem Encrypted

πŸ“¦ Overview​

This Terraform module provisions an encrypted Amazon EFS file system with data-at-rest encryption enabled by default using AWS-managed KMS keys.

It’s ideal for secure, shared storage in compliance-driven or regulated workloads across multiple EC2 instances.


βœ… Key Features​

  • Enables encryption-at-rest using AWS-managed KMS keys
  • Creates mount targets in specified subnets
  • Attaches custom security groups for access control
  • Supports multi-AZ, scalable file storage
  • Adds environment tags for visibility and cost tracking

πŸ’Ό Use Cases​

  • Encrypted storage for regulated workloads (HIPAA, PCI, FedRAMP)
  • File sharing between EC2 instances across Availability Zones
  • Secure NFS volumes in shared service environments
  • Enterprise workloads requiring default encryption policies

πŸ“₯ 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 for mount target placement
security_groupslistList of security group IDs to associate with mount targets

πŸ“€ Outputs​

NameDescription
efs_filesystem_idThe ID of the encrypted EFS filesystem
mount_target_idsA list of mount target IDs created
efs_arnThe ARN of the EFS resource

πŸš€ 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_encrypted" {
source = "git::ssh://git@github.com/archiphire/aws-level-1-modules.git//storage/efs-filesystem-encrypted?ref=v1.0.0"

region = "us-east-1"
environment = "prod"
subnet_ids = ["subnet-xxxxxxxx", "subnet-yyyyyyyy"]
security_groups = ["sg-zzzzzzzz"]
}
terraform init
terraform plan
terraform apply

or

tofu init
tofu plan
tofu apply

🧹 Cleanup Options​

Terraform Destroy (for test environments):

terraform destroy

or

tofu destroy

Manual Cleanup (recommended for production): Unmount the EFS filesystem from clients Delete the EFS filesystem manually via AWS Console or CLI Clean up mount targets and unused security groups as needed

πŸ›‘οΈ Notes​

This is a Level 1 baseline module with encryption enabled. Use this as a secure foundation for any workload requiring encrypted, shared file storage.

πŸ”’ 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.