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:¶
- 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).
- First navigate to console.aws.amazon.com/ec2 in your browser, then click Snapshots on the left, selecting private snapshots.
- Select the Shared Snapshot, and select "Create Volume", specifying the AZ the instance is in.
- Then select the instance to attach the volume.
- Remember the Device Name when attached (e.g. /dev/sdf ) as you will need it to mount the volume.
- 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