- chmod 400 key.pem
- ssh -i publickey.pem [email protected] -p 911
- scp -P 911 -i /home/jayant/Downloads/publickey.pem -r projectFolderName [email protected]:/home/ubuntu/
- du -sh projectFolderName ( display the size of the project folder )
To connect to an Amazon EC2 instance from an Ubuntu machine, you can use the Secure Shell (SSH) protocol. Here are the steps:
Open a terminal window on your Ubuntu machine.
Locate the private key file that you specified when you launched the EC2 instance. This file will have a ".pem" file extension and is required to establish the SSH connection.
Change the permissions of the private key file to be read-only for the owner. This is done to prevent unauthorized access to the file.
chmod 400 path/to/private_key.pem
Connect to the EC2 instance using the following command, replacing username with the appropriate username for the instance, and instance_ip_address with the public IP address of the instance:
ssh -i path/to/private_key.pem username@instance_ip_address
You should now be logged in to your EC2 instance, and you can run commands and manage your instance from the terminal window on your Ubuntu machine.
Note: The default username for an EC2 instance varies based on the operating system being used. For example, for an Ubuntu instance, the default username is "ubuntu".