For Key pair name, enter a name for the new key pair, and then choose Create key pair.
Your browser will download the private key file automatically. The private key file is automatically downloaded by your browser. The base file name is the name you specified as the name of your key pair, and the file name extension is .pem. Save the private key file in a safe place.
Choose Close.
Important: You can create a key pair only once. Be sure to save the private key file to your computer. You’ll need to provide the name of your key pair when you launch an instance and the corresponding private key each time you connect to the instance.
2: Connect to your instance
Open a terminal window.
Use the cd command to navigate to the directory where your private key file is located.
Use the following command to set the permissions of your private key file so that only you can read it:
1
chmod 400 /path/my-key-pair.pem
Use the following command to connect to your instance. Replace ec2-user with the appropriate user name for your AMI.
For Amazon Linux 2 or the Amazon Linux AMI, the user name is ec2-user.
For a CentOS AMI, the user name is centos.
For a Debian AMI, the user name is admin.
For a Fedora AMI, the user name is ec2-user or fedora.
For a RHEL AMI, the user name is ec2-user or root.
For a SUSE AMI, the user name is ec2-user or root.
For an Ubuntu AMI, the user name is ubuntu. Here my OS is Ubuntu.
Otherwise, if ec2-user and root don’t work, check with your AMI provider.
1
ssh -i /path/my-key-pair.pem user_name@ip_address
3: (Optional) Connect to your instance using a password
Open a terminal window.
Use the following command to connect to your instance.
1
ssh user_name@my-instance-ip
I meet Permission denied (publickey) error.
To fix it.
Step1: Firstly I need to use the previous command to connect to my instance.
1
ssh -i /path/my-key-pair.pem user_name@ip_address
Step2: Set up a password for the user using passwd command along with the username.
1
sudo passwd ubuntu
Step 3: Edit sshd_config file.
1
sudo vim /etc/ssh/sshd_config
Find the Line containing PasswordAuthentication parameter and change its value from no to yes.
1
PasswordAuthentication yes
If you want to set up root login, find PermitRootLogin parameter and change its value from prohibit-password to yes
This, https://alanzeng.com/, is my Github Pages static website and blog, powered by the Jekyll static site generator.
I’ve added GitHub-Issue-based comments to the bottom of this website using the plugin called utterances, which is totally awesome and makes it trivial to add a beautiful and user-friendly commenting system to your static website or blog.
[root@localhost ~] Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one. Username: Password: WARNING! Your password will be stored unencrypted in /root/.docker/config.json. Configure a credential helper to remove this warning. See https://docs.docker.com/engine/reference/commandline/login/#credentials-store Login Succeeded
[root@localhost ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE demo latest 1e5f6711d527 3 days ago 178MB [root@localhost ~]# docker tag demo:latest ***/demo:v1 [root@localhost ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE demo latest 1e5f6711d527 3 days ago 178MB ***/demo v1 1e5f6711d527 3 days ago 178MB [root@localhost ~]#
Push
1 2 3 4 5 6 7 8
[root@localhost ~]# docker push ***/demo:v1 The push refers to repository [docker.io/***/demo:v1] 833a0t6a6ff9: Pushed 10bfe4y2500e: Pushed d43sfdd7d594: Mounted from library/nginx c2adabsadfed: Mounted from library/nginx v1: digest: sha256:67dcdae5578c0374019bdc899731543cfd7c48fe5780e84233a258f2bf7d2ceda size: 1155 [root@localhost ~]#
Pull
1 2 3 4 5
[root@localhost ~]# docker pull ***/demo:v1 v1: Pulling from ***/demo:v1 Digest: sha256:67dcdae5578c0374019bdc899731543cfd7c48fe5780e84233a258f2bf7d2ceda Status: Downloaded newer image for ***/demo:v1 docker.io/llxxyy/nginx-io:v1