Rsync to AWS EC2 Using .PEM key

The standard AWS EC2 instances support using a .PEM key to log in, instead of a more common SSH username/password combination. If you want to use Rsync to transfer data from your local machine to an AWS EC2 instance you will need to change the Rsync command to be something like this:

rsync -rave "ssh -i PEMKEYFILE.pem" /path/to/local/files/* ec2-user@EC2_INSTANCE_HOSTNAME:/path/to/remote/files

For simplicities sake I ensured that I was in the directory where the .pem key was saved, but you can adjust the command to give the path to your key file.

Beyond this it’s just like regular Rsync, so just follow the on-screen commands and you get secured file transfer between your local machine and your remote AWS EC2 instance



Elasticsearch: Updating Index Analysis

It is also possible to define new analyzers for the index. But it is required to close the index first and open it after the changes are made.

For example if content analyzer hasn’t been defined on myindex yet you can use the following commands to add it:

POST /twitter/_close

PUT /twitter/_settings
  "analysis" : {

POST /twitter/_open

Connect to the MySQL on Docker with CMD

I connect to the bash into the running MySQL container:

$ docker exec -t -icontainer_mysql_name/bin/bash

-i is the shortcut for --interactive option. This options is used for keep STDIN open even if not attached

-t is the shortcut for --tty option, used to allocate a pseudo-TTY

I run MySQL client from bash MySQL container:

$ mysql -uroot -proot

-u is shortcut for --user=name option, used to define user for login if not current user.

-p is shortcut for -password[=name] option, used to define password to use when connecting to server. If password is not given it’s asked from the tty.


$ docker exec -t -i container_mysql_name /bin/bash -c "mysql -uroot -proot"