Skip to content

EC2

EC2

Get external IP address:

curl ipcurl.net/n

Get Information on Instances:

aws ec2 describe-instances --region <AWS_REGION> --profile <PROFILE_NAME>

Create Snapshot:

# e.g. <VOLUME_ID> = "vol-0eabf084f016b3913
aws ec2 create-snapshot --region <AWS_REGION> --profile <PROFILE_NAME> --volume-id <VOLUME_ID>

Get Information on Snapshot:

# e.g. <SNAPSHOT_ID> = snap-0daaac465901b9632
aws ec2 describe-snapshots --region <AWS_REGION> --profile <PROFILE_NAME> --snapshotids <
SNAPSHOT_ID>,<SNAPSHOT_ID>

Get Snapshot Information by User:
# e.g. <USER_ID> = 480927147553 -> can be retrieved with "aws sts get-caller-identity"
aws ec2 modify-snapshot-attribute --region <AWS_REGION> --profile <PROFILE_NAME> --snapshot-id <SNAPSHOT_ID> --attribute createVolumePermission --operation-type add --user-ids <USER_ID>

Mounting Volumes:

  1. If you don't have an instance in the same region, you'll need to create one. Make note of the Availability Zone shown in the Instance Details (us-east-1b, us-east-2b, etc).
  2. First navigate to console.aws.amazon.com/ec2 in your browser, then click Snapshots on the left, selecting private snapshots.
  3. Select the Shared Snapshot, and select "Create Volume", specifying the AZ the instance is in.
  4. Then select the instance to attach the volume.
  5. Remember the Device Name when attached (e.g. /dev/sdf ) as you will need it to mount the volume.
  6. SSH into the host you attached the volume to, check your devices to ensure you can see the new volume, create a mount point, and mount the volume.
    root@ip-10-0-1-251:/shared# ls /dev | grep df
    xvdf
    xvdf1
    root@ip-10-0-1-251:/shared# mkdir /mnt/snapshot
    root@ip-10-0-1-251:/shared# mount /dev/xvdf1 /mnt/snapshot
    root@ip-10-0-1-251:/shared# ls -alF /mnt/snapshot