Preview Files
# S3 File Preview with Commandeer
As developers, we often need to deal with some files on AWS S3. This post goes over several strategies on how to inspect the content of such files using the command line, AWS Console, or Commandeer.
# Command Line
Currently, there is no way to preview a file using the command line. If you would like to know what happens inside your files on S3, you'll need to download them to your local machine and open or preview each file using your operating system viewer. First, you'll need to install AWS CLI using AWS installation instructions. Here is a command you can run to download a file from a bucket to examine its content:
aws s3 cp s3://mybucket/test.txt test2.txt
Once the file is downloaded, just open it with your system previewer and see the content of it.
As you can see, even though using a terminal makes you look like you know some black magic, it involves several manual steps. First of all, you need to know the exact name of the file, so you may want to run another command before it to list all files in a bucket. It's ok to do it for a single file, and once you need to look into multiple folders for multiple files it becomes unmanageable. In addition to it, you'll need to constantly clean up your work in progress files you downloaded from AWS S3 which is another manual step you need to do. Is there another way? Sure thing.
# AWS Console
AWS offers the AWS console which is a graphical interface for browsing and downloading files. Unfortunately, this way involves a lot of painful clicking. First of all, you need to get to S3 by clicking inside the search bar, typing S3, clicking on the link, and waiting while staring at the spinner.
Now the "fun" starts, you'll need to go back and forth between the folders by clicking on each folder, the back browser button or on the breadcrumbs at the top, finding the file you're looking for. Now that you found your file, you'll need to click into it, click the download button at the top, choose a path, and save it. After you saved it, you can open it in your editor to check the content.
After looking into the content of the file, if you see that's the file you were looking for, congratulations. After doing all this work to find the file you deserve a month-long vacation. If not, you'll need to get back into clicking to find the right one. Can we do better? Of course.
# Commandeer
Commandeer solves all problems above by showing the file structure in an intuitive tree view. You can navigate through it without clicking the back browser button. You won't need to constantly log into your AWS account and to search through the list of services just to get to your S3 buckets. The best of all, you don't even need to download a file to know its contents. Just click on it and see the file content in the detail view on the right. Commandeer used syntax highlighting for most popular programming languages. The editor's color also changes with light and dark mode.
# Final Thoughts
At Commandeer we believe that engineers do very impactful work. In order to do it efficiently, we need to have the best tools available. We strive to bring developers the best cloud experience possible in order to unlock the true developer potential. Download the app below and let us know how we can make it better.