AWS EC2 Instance Store Storage

EC2 Instance Store

  • An instance store provides temporary or Ephemeral block-level storage for an Elastic Cloud Compute – EC2 instance.
  • is located on the disks that are physically attached to the host computer.
  • consists of one or more instance store volumes exposed as block devices.
  • The size of an instance store varies by instance type.
  • Virtual devices for instance store volumes that are ephemeral[0-23], starting the first one as ephemeral0 and so on.
  • While an instance store is dedicated to a particular instance, the disk subsystem is shared among instances on a host computer.
  • is ideal for temporary storage of information that changes frequently, such as buffers, caches, scratch data, and other temporary content, or for data that is replicated across a fleet of instances, such as a load-balanced pool of web servers.
  • delivers very high random I/O performance and is a good option for storage with very low latency requirements, but you don’t need the data to persist when the instance terminates or you can take advantage of fault-tolerant architectures.

EC2 Instance Store

Instance Store Lifecycle

  • Instance store data lifetime is dependent on the lifecycle of the Instance to which it is attached.
  • Data on the Instance store persists when an instance is rebooted.
  • However, the data on the instance store does not persist if the
    • underlying disk drive fails
    • instance terminates
    • instance hibernates
    • instance stops i.e. if the EBS-backed instance with instance store volumes attached is stopped
  • Stopping, hibernating, or terminating an instance would cause every block of storage in the instance store to be reseted.
  • If an AMI is created from an Instance with an Instance store volume, the data on its instance store volume isn’t preserved.

Instance Store Volumes

  • Instance type of an instance determines the size of the instance store available for the instance and the type of hardware used for the instance store volumes.
  • Instance store volumes are included as part of the instance’s hourly cost.
  • Some instance types use solid-state drives (SSD) to deliver very high random I/O performance, which is a good option when storage with very low latency is needed, but the data does not need to be persisted when the instance terminates or architecture is fault tolerant.

Instance Store Volumes with EC2 instances

  • EBS volumes and instance store volumes for an instance are specified using a block device mapping.
  • Instance store volume
    • can only be attached to an EC2 instance only when an instance is launched.
    • cannot be detached and reattached to a different instance.
  • After an instance is launched, the instance store volumes for the instance should be formatted and mounted before it can be used.
  • Root volume of an instance store-backed instance is mounted automatically

Instance Store Optimizing Writes

  • Because of the way that EC2 virtualizes disks, the first write to any location on an instance store volume performs more slowly than subsequent writes.
  • Amortizing (gradually writing off) this cost over the lifetime of the instance might be acceptable.
  • However, if high disk performance is required, AWS recommends initializing the drives by writing once to every drive location before production use

EBS vs Instance Store

Refer blog post @ EBS vs Instance Store

AWS Certification Exam Practice Questions

  • Questions are collected from Internet and the answers are marked as per my knowledge and understanding (which might differ with yours).
  • AWS services are updated everyday and both the answers and questions might be outdated soon, so research accordingly.
  • AWS exam questions are not updated to keep up the pace with AWS updates, so even if the underlying feature has changed the question might not be updated
  • Open to further feedback, discussion and correction.
  1. Please select the most correct answer regarding the persistence of the Amazon Instance Store
    1. The data on an instance store volume persists only during the life of the associated Amazon EC2 instance
    2. The data on an instance store volume is lost when the security group rule of the associated instance is changed.
    3. The data on an instance store volume persists even after associated Amazon EC2 instance is deleted
  2. A user has launched an EC2 instance from an instance store backed AMI. The user has attached an additional instance store volume to the instance. The user wants to create an AMI from the running instance. Will the AMI have the additional instance store volume data?
    1. Yes, the block device mapping will have information about the additional instance store volume
    2. No, since the instance store backed AMI can have only the root volume bundled
    3. It is not possible to attach an additional instance store volume to the existing instance store backed AMI instance
    4. No, since this is ephemeral storage it will not be a part of the AMI
  3. When an EC2 instance that is backed by an S3-based AMI Is terminated, what happens to the data on the root volume?
    1. Data is automatically saved as an EBS volume.
    2. Data is automatically saved as an EBS snapshot.
    3. Data is automatically deleted
    4. Data is unavailable until the instance is restarted.
  4. A user has launched an EC2 instance from an instance store backed AMI. If the user restarts the instance, what will happen to the ephemeral storage data?
    1. All the data will be erased but the ephemeral storage will stay connected
    2. All data will be erased and the ephemeral storage is released
    3. It is not possible to restart an instance launched from an instance store backed AMI
    4. The data is preserved
  5. When an EC2 EBS-backed instance is stopped, what happens to the data on any ephemeral store volumes?
    1. Data will be deleted and will no longer be accessible
    2. Data is automatically saved in an EBS volume.
    3. Data is automatically saved as an EBS snapshot
    4. Data is unavailable until the instance is restarted
  6. A user has launched an EC2 Windows instance from an instance store backed AMI. The user has also set the Instance initiated shutdown behavior to stop. What will happen when the user shuts down the OS?
    1. It will not allow the user to shutdown the OS when the shutdown behavior is set to Stop
    2. It is not possible to set the termination behavior to Stop for an Instance store backed AMI instance
    3. The instance will stay running but the OS will be shutdown
    4. The instance will be terminated
  7. Which of the following will occur when an EC2 instance in a VPC (Virtual Private Cloud) with an associated Elastic IP is stopped and started? (Choose 2 answers)
    1. The Elastic IP will be dissociated from the instance
    2. All data on instance-store devices will be lost
    3. All data on EBS (Elastic Block Store) devices will be lost
    4. The ENI (Elastic Network Interface) is detached
    5. The underlying host for the instance is changed

References

19 thoughts on “AWS EC2 Instance Store Storage

    1. The question targets the Ephermal storage (Instance store) volumes attached to the EC2 instances which have their root volume as EBS.
      These EC2 instances can be stopped and started and the data on EBS would remain, however, the data on the instance store volume attached to the instance will be lost.

      1. Ok thanks for the clarifications , hope you are not bugged with my questions as it will help the blog with more keywords for search engine 🙂

        I am just now confused what is the “root” ephermal ?
        i create servers which got the root device type as “ebs” and when i stop them i see they saying all data will be deleted but all the data in:

        /home/
        /etc/
        or root “/”
        not touched when i stop and start and still there
        what data will be removed , can you give example ?

        1. When you launch an EC2 instance there needs to be a root volume attached to it for OS and other system stuff.
          This can be either EBS (network device) or Instance store (also referred to as Ephermal – which means short lived and attached to the instance itself) volume.
          Instance Store backed EC2 instance cannot be stop as you would lose the data. Only options are restart and terminate
          In addition to the root volume, an EC2 instance can be attached multiple data volume for e.g. volume which holds your application data.
          With EBS data volumes, you easily detach and attach the volumes to different EC2 instance in case of EC2 failure.
          For an EBS backed EC2 instance, you can attach Instance store data volumes.
          A EBS backed EC2 instance, can be stopped and started. So the contents of root volume are not lost.
          But All the instance store data volumes attached to it will lose the data.

          1. I believe i got it now, so you mean when you create an EBS backed instance the main storage is not ephemeral and then you will not lose the data if you stopped it, but if you add an instance store volume to that instance and mount it then it’s an ephemeral and data will be lost if you stop it “From that mounted storage and not the EBS one”

            Thanks Man.

  1. Hi Jay
    For Qn. 2 Answer is given as option 1 .
    But I am confused due to the below statement . Can you please help me to undestand
    “if you create an AMI from an instance, the data on its instance store volumes isn’t preserved and isn’t present on the instance store volumes of the instances that you launch from the AMI.”

    1. Refer link
      If you add instance store volumes to your instance in addition to the root device volume, the block device mapping for the new AMI contains information for these volumes, and the block device mappings for instances that you launch from the new AMI automatically contain information for these volumes

      1. So it wont have the actual data but information about the volume .
        But Qn says “Will the AMI have the additional instance store volume data?”
        So I thought they are referring to actual data in Question .

  2. Hi,

    I believe ans for this question is b.
    In the question nowhere it is mentioned it instance store instance.

    5. When an EC2 EBS-backed instance is stopped, what happens to the data on any ephemeral store volumes?
    a. Data will be deleted and will no longer be accessible.
    b. Data is automatically saved in an EBS volume.
    c. Data is automatically saved as an EBS snapshot.
    d. Data is unavailable until the instance is restarted.

    Regards,

    1. It is about the EBS backed instance having and ephemeral store volume as secondary volumes.

  3. when an EC2 instance in a VPC (Virtual Private Cloud) with an associated Elastic IP is Rebooted/restarted then does The underlying host for the instance is changed or remains the same?

  4. Ques. 4. A user has launched an EC2 instance from an instance store backed AMI. If the user restarts the instance, what will happen to the ephemeral storage data?

    How data is preserved in this case? It the instance is restarted then data from instance store should be deleted…

    1. Actually restart here is reboot and it does not delete the data but stop and start does.

  5. your work is great may god bless u for this hard work
    for question 6.
    option b. It is not possible to set the termination behavior to Stop for an Instance store backed AMI instance

    wht is mean by “termination behaviour ” does it mean shutdown… so does EBS backed volume allows it then how

    1. Thanks Rishi,
      it should be the shutdown behaviour as you cannot stop a EC2 instance with instance store but only a EBS backed EC2 instance.

Comments are closed.