# AWS Transfer Family SFTP Server using Amazon EFS domain with automated operations Large organizations are migrating existing on-premises workloads to the AWS. Many of these workloads are legacy applications that are running on the Amazon EC2 instances. Often these legacy applications exchange files with other applications or trading partners via SFTP. Each SFTP client requires their own secured area for `inbound` and `outbound` files. The legacy application, however, requires access to all the files exchanged with all the SFTP clients. This solution is a set of [Terraform](https://www.terraform.io/) modules and examples. It provisions an [AWS Transfer Family](https://aws.amazon.com/aws-transfer-family/) SFTP server that uses an [Amazon EFS](https://aws.amazon.com/efs/) File System via an Amazon EFS Access Point as the storage backend. It also provisions automation for the SFTP client folder maintenance on the Amazon EFS File System. Optionally, the solution can send SFTP client folder status email and SFTP activity email to different subscribers. The Amazon EFS File System can be mounted on the Amazon EC2 instance(s) hosting the target application(s) needing access to the `inbound` and `outbound` files.

Use [examples/efs/scenario1](https://github.com/aws-samples/aws-tf-transfer-sftp-efs/tree/main/examples/efs/scenario1) to setup this scenario.
Use [examples/sftp/scenario1](https://github.com/aws-samples/aws-tf-transfer-sftp-efs/tree/main/examples/sftp/scenario1/) to execute this scenario.
### Scenario 2: Shared EFS and Owned EFS Access Point
- EFS file system exists and optionally encrypted using KMS.
- EFS access point does not exist. It is owned by the SFTP server.
- EFS mount points exist in the target VPC Subnets.
- EFS Security Group exists and attached to the EFS mount points.
Use [examples/efs/scenario2](https://github.com/aws-samples/aws-tf-transfer-sftp-efs/tree/main/examples/efs/scenario2) or [examples/efs/scenario1](https://github.com/aws-samples/aws-tf-transfer-sftp-efs/tree/main/examples/efs/scenario1) to setup this scenario.
Use [examples/sftp/scenario2](https://github.com/aws-samples/aws-tf-transfer-sftp-efs/tree/main/examples/sftp/scenario2/) to execute this scenario.
### Scenario 3: Owned EFS and Owned EFS Access Point
- EFS file system does not exist. It is owned by the SFTP server.
- EFS access point does not exist. It is owned by the SFTP server.
- EFS mount points do not exist. It will be created along with the EFS.
- EFS Security Group does not exist. It will be created along with the EFS.
Use [examples/sftp/scenario3](https://github.com/aws-samples/aws-tf-transfer-sftp-efs/tree/main/examples/sftp/scenario3/) to execute this scenario.
## Future Enhancements
- The current solution only takes actions for the `CreateUser` event. The solution can be enhanced to support `UpdateUser` and `DeleteUser` events.
- The solution can be enhanced to support the VPC hosted `internet-facing` SFTP Server using Elastic IP addresses.
- The solution be can be enhanced to support other identity providers such as AWS Directory Service and Custom Identity Provider.
- The current solution proposes one SFTP server per application. The solution can be enhanced to support single SFTP server for multiple applications that would allow a single SFTP client to securely exchange files with multiple applications.
- The current solution sends basic email alert and report. It can be enhanced to send better looking emails.
- The current solution assumes a single AZ in a single region. It could leverage multiple AZs and / or use EFS replication to provide multi-region availability.
- The current solution does not employ any form of backup. EFS has the ability to do automatic backups and this could be leveraged.
- EFS performance and throughput should be configured based on desired behavior from regular usage.
## Security
See [CONTRIBUTING](https://github.com/aws-samples/aws-tf-transfer-sftp-efs/tree/main/CONTRIBUTING.md#security-issue-notifications) for more information.
## License
This library is licensed under the MIT-0 License. See the [LICENSE](https://github.com/aws-samples/aws-tf-transfer-sftp-efs/tree/main/LICENSE) file.