Remove Key from known_hosts

If you’ve changed keys, you will need to delete a ssh key from /etc/known_hosts file.

You can edit it manually using an editor such as vi or vim.

vim ~/.ssh/known_hosts

Or you can use ssh-keygen command with -R option to delete the hostname or IP address.

ssh-keygen -f "~/.ssh/known_hosts" -R ""

SSH to CodeCommit

Although you can access CodeCommit from the AWS Console, the most efficient way to access it, is via SSH. Assuming you already have an IAM user, as well as Git installed on your local machine, it’s time to setup a SSH connection to CodeCommit by performing the following commands.

  1. Generate a RSA key pair
  2. Copy the public key to the clipboard.
  3. Upload the SSH public key to the AWS IAM Console.
  4. You’ll receive a SSH Key ID.
  5. Create a config file
  6. chmod 600 config
  7. Test connection
  8. Clone repo

To get more details regarding SSH access to CodeCommit, visit the AWS docs.

SSH To A Docker Container

Docker containers are awesome. Docker allows you to quickly create development environments in a matter of minutes. Docker gives you the ability to package, ship and share your docker image to anyone. Once your docker image is on the Docker repository, anyone can pull it down and run it on their own operating system.

To keep track of running containers on your system, you can type ‘docker ps -a’ on your terminal.

$ docker ps -a
# gives a result similar to this ...
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES
f322d2370415        moul/icecast        "/"              2 hours ago         Up 2 hours>8000/tcp   icecast_icecast_1

If you would like to SSH to a running Docker container, just run the following from the terminal.

docker exec -t -i f322d2370415 /bin/bash
# it will take you to this ... 

f322d2370415 is the Container ID, while /bin/bash is the shell that you would like to use.