This project aims to create an SFTP server with storage in an S3 bucket within AWS. Although AWS offers this service (https://aws.amazon.com/aws-transfer-family/pricing/), the solution presented here is more cost-effective. It relies on a t4g.nano
server, which is very inexpensive due to its low power. This project uses the https://github.com/s3fs-fuse/s3fs-fuse project.
Once the server is deployed, all connection information will be sent by email.
provider.tf
file to ensure that you can store your tfstate
correctly.
In the jajsftp.tf
file, you can declare your configuration as follows:
module "jajsftp" {
source = "./modules/jajsftp"
name = "JAJSFTP"
admin_whitelist = [
"12.12.12.12"
]
admin_username = "admin"
admin_email = "[email protected]"
}
name
: This is the name of your project. The resources created will use this name.admin_whitelist
: The list of IP addresses allowed to access the SFTP.admin_username
: The username for logging into the SFTP.admin_email
: The email address to receive login information.
Once the module is configured, you can run Terraform:
terraform init
terraform plan
terraform apply
If you have successfully verified your email identity through Amazon, you should receive the email containing the information within 5 to 10 minutes.
You can use this bash script to deploy the server manually by using install_script.sh.tpl. Just replace the variables as follows:
ADMIN_USERNAME="your_username"
ADMIN_EMAIL="your_email"
S3_NAME="your_bucket_name"
AWS_REGION="your_region"