Iterm2 + Tmux = Awesome

If you regularly work with the terminal, especially if your work with remote servers via SSH, you must know about Tmux. It is an awesome tool that makes your work so much easier!

What is Tmux? Tmux stands for a terminal multiplexer. It basically allows you to open multiple terminal sessions inside a single terminal window or even remote terminal session (like when you SSH into a server). This may not seem like very cool to you now, but let’s look at some examples of how it works and I’m sure you’ll love it :)
Read more

AWS Roles. When and how I can use them?

Unless you work via AWS Management Console, in order to access AWS resources you talk to AWS API. All API requests that you make need to be signed by secret access keys (access key ID and secret access key), so that AWS could identify who is making the request and prevent strangers from accessing your resources.

If you ever worked with tools like AWS CLI and Terraform which allow you to manage your AWS infrastructure, then you know that they require AWS credentials in order to work, because they work by making API requests to AWS API. When you work with these tools, you usually put your credentials to a special .aws folder under your user, and they simply take it from there every time you use them.

But what do you do when you need to provide access to AWS resources to some scripts or an application running on your EC2 instance? For example, your application running on an EC2 instance might need to save or fetch some files from an S3 bucket. Do you just put user credentials on that instance in this case? Although this will work, there’s a better way to do this…
Read more

Master Git (part V). Change commits in your history. Interactive rebase.

When you work with with version control, you sometimes find yourself in situations when you would like to edit or delete the saved changes in your project’s history. Well, in this case, you should know that rewriting your project’s history could be dangerous.

Unless you work on a project alone, you will have to share your changes to the project (commits) with other people. In most cases, you share commits via a central server like Bitbucket or Github other than directly with other developers. I’m sure you already know that when we make a new commit it’s based on some other commit(s) which is considered to be the new commit’s parent(s). So once you shared your commits, they will constitute the basis for the work of other people. Rewriting or deleting commits that you already shared with others would mean a whole lot of trouble for those who based their work on those commits. So unless you want your colleagues to hate you, follow this simple rule:

Never change commits which you already shared with others.

If you want to undo the changes in your project’s history, just create a new commit that corrects or completely removes the changes introduced by previous commits. There is the revert command which allows you to do just that.

If you understood that rewriting your public history is bad, then you’re safe to keep reading :) Today I will show you how changing commits could be useful.
Read more

How to work with multiple AWS accounts.

Ever had to work with multiple AWS accounts? If so, then you probably have a working solution on how to make switching accounts easier, in which case don’t hesitate to share it with me in the comments below. But if you still find troublesome managing your multiple AWS credentials, then you should find this post interesting.

If you’re used to working with just one AWS account, you most probably used aws configure command to quickly set up your default credentials like this.


Recently, I find myself in a situation, when I had to switch between two AWS accounts of two different companies. As it’s clearly not a rare case, the first thing I did was to look for a solution on how to manage multiple profiles that Amazon itself would suggest.
Read more

Master Git (part IV). Stash your changes

Imagine a situation when you start working on some part of your project, make a bunch of uncommitted changes, but something urgent comes up that requires you to quickly make a few commits concerning another part of the project. In such cases, instead of losing the work you have already done, you can use git stash command to save your uncommitted changes away for later use while switching to another task.

Stashing in git is simple. All you need to do is to run

$ git stash

and git will make it look like those uncommitted changes are gone and your repository is clean:
Read more