SFTP To Go Add-On By Crazy Ant Labs On Heroku
We all at some point in our programming journey have come across Heroku a cloud-native platform for developing applications in various languages. It offers us many inbuilt features in one platform such as Github, Docker Integrations, Command-Line, Web UI, and various other add-ons to choose from. Heroku has been one of the most loved places for free hosting of websites and is said to be a polyglot platform as it has features for a developer to build, run and scale applications in a similar manner across most languages.
One of the major problems that Heroku has is the storage of files
Heroku has an “ephemeral” file system, where although we can write files to our disk, there is no guarantee that those files will persist after the application is restarted.
Now, in rescue to this, although Heroku has several storage add-ons, in this article, I am going to talk about SFTP To Go add-on created by Crazy Ant Labs its features, setup, and integration with Nodejs code.
What is SFTP To Go?
SFTP To Go is secure, scalable, and durable cloud storage that is primarily used to secure file access, transfer, and management either automatically or manually without the need to maintain and handle APIs.
Setting up your Environment
Setting up your SFTP To Go is quite easy and also follows its principle of zero management, let us see how to configure and setup our environment, there are basically two ways to add SFTP To Go to your application which are:
Adding SFTP To Go using Heroku UI
- Go to the Heroku Dashboard and select any one of the existing projects, if there is no existing project, create one
2. After selecting the project go to the installed add-ons section and click on Configure Add-ons
3. Now, click on Find more add-ons
4. Now, select SFTP To Go from the available add-ons from the Data Stores section
5. Next, click on install SFTP To Go on the rightmost top corner of the window
6. Now, select any add-on plan and select the application in the search bar with which the add-on has to be connected and click on Submit Order Form
7. Next, wait for a few seconds to get the add-on started and now, we can copy our URI and passcode to get started!
Adding SFTP To Go using Heroku CLI
- Login to your Heroku account using the command and enter the credentials such as email and the password on the terminal
heroku login -i
2. Now, use the command to add the SFTP To Go add-on to your Heroku dashboard
heroku addons:create sftptogo:bronze -a APP_NAME
in the above command, bronze is the name of the plan given, the other plans which are available are Micro, Mini, Small, Starter, Professional, and Premium.
Once ready you can access the SFTP To Go Dashboard directly from Heroku
You can also view your add-ons on the dashboard here
In your SFTP To Go dashboard, you can find all your information related to the credentials (SFTP / FTPS ACCESS and Amazon S3), Network Security configuration, and Webhooks
Verify the Access
Now, once the add-on is installed the repository is ready to be accessed through the command line after you enter the given URI and password given in your SFTP To Go dashboard
sftp *****************.sftptogo.com
sftp> ls
dir
sftp> mkdir storageFile
storageFile
Here you can create your own directories and files for storage. We can also know the URL to your provisioned SFTP service, including the root username, password, and host by the following command
heroku config:get SFTPTOGO_URL -a APP_NAME
Application Features
While using SFTP To Go with Nodejs, the following npm package needs to be installed to the package.json file using the following command
npm install ssh2-sftp-client
and its usage as
let Client = require('ssh2-sftp-client');
let sftp = new Client();
sftp.connect({
host: '*********.sftptogo.com',
port: '22',
username: 'swapnilkant11',
password: '******'
}).then(() => {
return sftp.list('/');
}).then(data => {
console.log(data, 'the data info');
}).catch(err => {
console.log(err, 'catch error');
});
Adding Credentials to the SFTP To Go dashboard
One can add other credentials also from the SFTP To Go dashboard other than the root
one can enter the username and the home directory, choose the permission from the list and click on Add credential now, there will be an additional credential added to the dashboard. Other permissions include read-only, write-only, and read and write
What are Webhooks?
Events such as file deletion, file updation can be notified through an inbuilt feature in SFTP To Go called webhooks. One can configure webhooks from the dashboards by entering the Endpoint URL, authorization header, and type of events to monitor.
Why do we need this?
SFTP To Go comes up with various features which are very unique and reliable some of them are:
- One-Click Setup: It provides seamless and quick access to our SFTP server, our secure SFTP server is just a few clicks away also providing us with one-click password rotation
- Amazon S3 Access: This allows us to access our files using Amazon S3 service APIs which means that we can access the same files using a different, more modern interface
- Run At Scale: Built on top of the Amazon cloud platform can scale as traffic and file sizes increase and also, allows us to cap our storage and bandwidth quotas at fixed monthly costs and scales it up after discussion with the user
- Webhooks: Comes up with a webhook that automatically notifies us when there is any change in the file involving updation and deletion
- Network Inbound Rules: Defines a set of IP addresses that are safe to have access to our server
Security at SFTP To Go
SFTP To Go comes up with the following security features:
- Data Security: For data encryption, SFTP To Go uses SSL/TLS encryption on all their websites and microservices, and also the platform never uses our data to content or derive information from it for marketing or advertising and regular verification of security certificates and encryption algorithms is carried out to keep our data safe.
- Network Security: By default, all access is denied, and only explicitly allowed ports and protocols are allowed based on business requirements.
- System Security: The principle of least privilege is followed both internally by restricting their staff’s access to the minimum permissions needed to perform the work, as well as externally by asking the user for the minimum permissions required by their service when accessing 3rd party systems on the user’s behalf.
Summary
Now, talking about the summary of this article we have the following features of SFTP To Go:
- Comes up with easy and fast setup features
- Can be accessed from anywhere by adding the IP address which uses the SFTP server
- Webhooks provides easy and fast notification features including simple to set up and manage
- Comes up with extensive security features including password rotation, IP filtering, SSH keys, multiple credentials for fine-grained access control.
Conclusions
SFTP To Go is one of the best and fully-managed cloud SFTP storage for your Heroku applications which is flexible, scalable, and easy to get started with and I am really impressed with the product on its features of zero management, scalability features, webhook feature, security, etc features which are not present in other cloud storage add-ons.
Would love to see:
- free tier available: allow developers to start small projects at no cost
- file update notifications: allow webhooks to notify when an existing file has been modified
Keep learning and keep growing and also keep exploring more!
All the very best!
For more interesting and informative articles and tips follow me on Medium and Linkedin