# LAB - Moving a volume from one EC2 instance to the next

can Anyone explain me how to run this code step by step.

I cannot find pem file
lab

LAB - Moving a volume from one EC2 instance to the next

https://learn.kodekloud.com/user/courses/aws-solutions-architect-associate-certification/module/23e00d1f-6422-4fef-a9bf-e8f007be5514/lesson/ba93c990-3c45-4c75-9c29-e304c26adac9

Access the instance1 through SSH and run below command to create a filesystem of type xfs using the ebs volume attached.
Use lsblk for name of volume attached.

sudo mkfs -t xfs /dev/xvdf

Note: keypair file for instance1 is located at /home/rdskeypair.pem

somir@LAPTOP-QLJH61G9 MINGW64 ~
$ ssh -i /home/rdskeypair.pem [email protected]
Warning: Identity file /home/rdskeypair.pem not accessible: No such file or directory.
[email protected]: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

it’s where they say it is, but it’s only readable by root:

~ on ☁️  (us-east-1) ➜  pwd
/root

~ on ☁️  (us-east-1) ➜  cd /home/
bob/            rdskeypair.pem  ubuntu/         

~ on ☁️  (us-east-1) ➜  ls -l /home/
total 12
drwxr-x--- 1 bob    bob    4096 Aug 14 10:48 bob
-r-------- 1 root   root   1675 Aug 23 01:58 rdskeypair.pem
drwxr-x--- 2 ubuntu ubuntu 4096 May 30 02:05 ubuntu

so you’ll need to use sudo to get access to it.

Im getting this error while doing in the lab

https://learn.kodekloud.com/user/courses/aws-solutions-architect-associate-certification/module/23e00d1f-6422-4fef-a9bf-e8f007be5514/lesson/ba93c990-3c45-4c75-9c29-e304c26adac9

$ ssh -i /home/rdskeypair.pair [email protected]**
Warning: Identity file /home/rdskeypair.pair not accessible: No such file or directory.

Again: YOU DID NOT DO THAT AS ROOT!!! So the file is not accessible, as I believe is directory /home. not accessible. DO IT WITH SUDO!

Hi Rob!
Same error here.
Where can I get this file rdskeypair.pem ?
To connect to the instances running on AWS I need this private RSA key file. Could not find it in the course. Also the RDS course labs cannot be attended because this file is missing.
Where can we get this file?

You need to use the terminal in the lab (in otherwords, NOT the cloud shell window). Accessing the instance is pretty simple from there:

~ on ☁️  (us-east-1) ✦ ➜  cd /home/

/home on ☁️  (us-east-1) ✦ ➜  ls
bob  rdskeypair.pem  ubuntu

/home on ☁️  (us-east-1) ✦ ➜  chmod 400 /home/rdskeypair.pem

/home on ☁️  (us-east-1) ✦ ➜  ssh -i /home/rdskeypair.pem [email protected]
The authenticity of host 'ec2-3-210-203-232.compute-1.amazonaws.com (3.210.203.232)' can't be established.
ED25519 key fingerprint is SHA256:8PmayBmLG1k//hkM3exjV75rbv7nuvWr+LETEg5dcY4.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'ec2-3-210-203-232.compute-1.amazonaws.com' (ED25519) to the list of known hosts.

A newer release of "Amazon Linux" is available.
  Version 2023.1.20230809:
  Version 2023.1.20230825:
  Version 2023.1.20230906:
  Version 2023.1.20230912:
  Version 2023.2.20230920:
  Version 2023.2.20231002:
  Version 2023.2.20231011:
  Version 2023.2.20231016:
  Version 2023.2.20231018:
  Version 2023.2.20231026:
  Version 2023.2.20231030:
  Version 2023.2.20231113:
  Version 2023.3.20231211:
  Version 2023.3.20231218:
  Version 2023.3.20240108:
  Version 2023.3.20240117:
  Version 2023.3.20240122:
  Version 2023.3.20240131:
  Version 2023.3.20240205:
  Version 2023.3.20240219:
  Version 2023.3.20240304:
  Version 2023.3.20240312:
  Version 2023.4.20240319:
  Version 2023.4.20240401:
  Version 2023.4.20240416:
  Version 2023.4.20240429:
  Version 2023.4.20240513:
  Version 2023.4.20240528:
  Version 2023.4.20240611:
  Version 2023.5.20240624:
  Version 2023.5.20240701:
  Version 2023.5.20240708:
  Version 2023.5.20240722:
  Version 2023.5.20240730:
  Version 2023.5.20240805:
  Version 2023.5.20240819:
  Version 2023.5.20240903:
  Version 2023.5.20240916:
  Version 2023.5.20241001:
  Version 2023.6.20241010:
  Version 2023.6.20241028:
  Version 2023.6.20241031:
  Version 2023.6.20241111:
  Version 2023.6.20241121:
  Version 2023.6.20241212:
  Version 2023.6.20250107:
  Version 2023.6.20250115:
  Version 2023.6.20250123:
  Version 2023.6.20250128:
  Version 2023.6.20250203:
  Version 2023.6.20250211:
  Version 2023.6.20250218:
  Version 2023.6.20250303:
  Version 2023.6.20250317:
  Version 2023.7.20250331:
  Version 2023.7.20250414:
  Version 2023.7.20250428:
  Version 2023.7.20250512:
  Version 2023.7.20250527:
  Version 2023.7.20250609:
  Version 2023.7.20250623:
  Version 2023.8.20250707:
  Version 2023.8.20250715:
Run "/usr/bin/dnf check-release-update" for full release and version update info
   ,     #_
   ~\_  ####_        Amazon Linux 2023
  ~~  \_#####\
  ~~     \###|
  ~~       \#/ ___   https://aws.amazon.com/linux/amazon-linux-2023
   ~~       V~' '->
    ~~~         /
      ~~._.   _/
         _/ _/
       _/m/'
[ec2-user@ip-172-31-7-72 ~]$ 

You can look up instance1’s address by doing aws ec2 describe-instances; both of the ec2 instances will be listed in JSON.