Can we mount a AMI snapshot to a local machine? - amazon-web-services

I want to determine a snapshot associated with a given AMI-ID, then mount a copy of that snapshot onto the local machine(and not AWS Instance).
I am using boto to get the snapshot-id from the AMI-ID
image = conn.get_image(ami)
snapshot_id = image.block_device_mapping.current_value.snapshot_id
Is it possible to mount a snapshot to a local machine and not a EC2-instance ?

For EBS backed AMIs there isn't a way to accomplish this that I'm aware of.
With an Instance Store-Backed AMI and quite a bit of effort, yes. See this blog post.
Other helpful resources:
Eight-Bit Guru's Answer
S3 vs. EBS backed instances
Selecting between EBS and Instance Store-Backed AMI

Related

AWS Snapshots not saving data

I created several snapshots from volumes of my instances months ago. Today I had to restore an instance based on a snapshot, but this instance does not contain any of my data, it is a clean version of Ubuntu, exactly as the first time I created the instance.
How do I restore my data?
thanks
In AWS there are two snapshot options:
1- Snapshot: You can use snapshots to capture a point-in-time state of your individual volumes.
2- Amazon Machine Image (AMI): You can use an AMI to capture a point-in-time state of your whole EC2 instance (VM), including all of its volumes.
So, difference is that snapshot is on individual volume level and AMI is the entire instance. Under the hood, AMI takes snapshots of all attached volumes and you can see those snapshots in the corresponding Snapshots page in AWS Management Console.
So to be clear, did you create an AMI from you Ubuntu instance and restored the same AMI? Or did you create a snapshot from one or more of its volumes? In that case, how did you restore it?
If you only take a snapshot of one or more of the volumes, after you restore your snapshots into new volumes attached to an instance, you should also remember to mount those volumes. But if you use an AMI, mounting may not be required, as long as you have added your volumes in the /etc/fstab.

Launch EBS backed AMI as an Instance store machine

How do I launch an EBS backed AMI as an instance store machine with out having to do too much hack? Also, more specifically, can I launch this using in an autoscaler?
I can answer the first part of your question. As far as I know you can not launch an EBS backed AMI as instance store machine. Instead what you can do is create an IS (instance store) backed AMI from the EBS backed running instance and use that to launch instance store backed instances.
The process of converting EBS backed instance to IS backed AMI not so straight forward. You need to start from a EBS backed paravirtual instance and after that I followed this answer for the conversion. To install AWS tools and command line utilities use this AWS tutorial.

Can I convert S3 backed AMI to EBS backed AMI?

Can I convert S3 backed AMI to EBS backed AMI? If yes, how?
Can I convert EBS backed AMI to S3 backed AMI? If yes, how?
When an Amazon EC2 instance is started, the contents of the chosen Amazon Machine Image (AMI) are copied to the boot disk. This boot disk can be either:
EBS-Backed, meaning the boot volume is created on an EBS volume (that persists even when the instance is stopped), or
Instance Store-Backed (aka S3-backed because the AMI is kept in Amazon S3), meaning that the AMI is copied to the Instance Store (aka Ephemeral disk), which is lost when the instance is stopped.
In the early days of EC2, only Instance Store was available. These days, EBS is the preferred storage medium. The only benefit of using Instance Store-Backed AMIs these days is that it's cheaper (no charge for EBS), but the instances can't be stopped and the data on the disk is lost when the machine stops.
Here's some links to instructions for converting between the types:
StackOverflow: Amazon EC2 - Convert EBS root device with instance store root device
StackOverflow: Amazon EC2 - Swap root instance store device with EBS device
AWS Blog: Converting an S3-Backed Windows AMI to an EBS-Backed AMI

AWS EC2 instance creation

I have two questions regarding EC2 and EBS.
Why do you need to create an EBS volume when creating an AMI ?
Why when I create an instance that is c3.2xlarge and comes with 2x80 SSD from my AMI why don't those two 80G SSDs appear in my machine?
Why do you need to create an EBS volume when creating an AMI ?
Not necessary. You can create EBS backed AMI as well as Instance stored Backed AMIs. Read below links:
Creating an Amazon EBS-Backed Linux AMI
Creating an Instance Store-Backed Linux AMI
If your requirement is something specific, then please elaborate.
Why when I create an instance that is c3.2xlarge and comes with 2x80 SSD from my AMI why don't those two 80G SSDs appear in my machine?
I just answered a similar question. Please find the explanation here on why you do not see the drives .

How do I find out which AWS Region an EBS snapshot lives?

Is there any way to figure out which region an AWS EBS snapshot lives in?
A collaborator shared an ebs snapshot with me but I'm having a very slow transfer rate when I attached it to my instance (which is in USEAST-1d). I was wondering if the snapshot lived somewhere else but couldn't find a way to check it.
Snapshots operate on Amazon EC2 regional scope. You cannot create a volume from a snapshot residing in different region. Since you are able to create a volume in US-East-1A, i assume your snapshot also resides on US-East region.
Also as eric mentioned it is not possible to attach a snapshot to an EC2 directly, you have to create an EBS volume and then attach the volume to EC2 instance