Launch EBS backed AMI as an Instance store machine - amazon-web-services

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.

Related

AWS launch new instance using Ubuntu 22.04: image has more volumes than instances allows

AWS launch new instance using Ubuntu 22.04:
The selected AMI contains more instance store volumes
than the instance allows. Only the first 0 instance
store volumes from the AMI will be accessible from the
instance
What does it mean? does an AMI have volumes?
EC2 instances can have two basic types of volumes: EBS (Elastic Block Store) and Instance Store. This article spells out the differences, but in a nutshell, EBS volumes are network attached storage that are independent of an instance, while Instance Store volumes are local block storage volumes that are not persistent (e.g. when the instance is terminated, the instance store volume is lost).
You ask if an AMI has volumes. An AMI basically is one or more volumes. The AMI is a snapshot of a disk in a particular state. These days, most modern AMIs use EBS storage for the root volume; that is, the volume that contains the operating system kernel that an instance boots from. It used to be commonplace to use Instance Store for the root volume, but EBS has become nearly as fast, more secure, and more reliable than Instance Store, so the use cases for Instance Store volumes are dwindling.
With all that said, I'm quite surprised that you're seeing this error. The error message suggests that the AMI includes Instance Store but the instance type you selected does not support Instance Store (many instance types do not). However, all Ubuntu 22.04 AMIs use EBS, not Instance Store. If you use the Ubuntu Amazon EC2 AMI Locator and search for "22.04", you'll find that all of the results have hvm:ebs-ssd as the instance type. Only very old Ubuntu AMIs have Instance Store volumes.
Make sure you are using the AMI Locator to find the Ubuntu 22.04 AMI. Those AMIs should work with most or all EC2 instance types.

AWS EC2 how to use pre-existing EBS volume as main bootable disk?

We have a EBS volume from a previous T2 instance, which contains operating system, mysql installation, created users and all configurations.
For launching a new instance (T2), how to use
the pre-existing EBS volume as main bootable disk so that we have the operating system, apps and all configurations? This would save us days of time and efforts.
For a business application, should we choose T2 or T3?
As discussed you can perform the below steps to create an EC2 instance from a pre existing EBS volume.
Create a snapshot from the EBS volume.
Create an AMI from the same.
Look for the AMI in your private AMI.
Create the EC2 instance with desired instance-type from this AMI.
Also you need to care for the EBS volumes with this new EC2 instance with minimum EBS volume size etc.
Please let me know.

Launching an Instance Store backed Instance

Just wanted to know, how can I launch an Instance Store Backed Instance, on the EC2 launch page I see all EBS backed AMIs. Don't see any Instance store backed AMI. Do I have to create an Instance Store Backed AMI first to launch an Instance Store backed instance.
You will need to use an instance store-backed AMI.
When launching an Amazon EC2 instance in the management console:
Select Community AMIs
For Root device type, select Instance store
Select a desired AMI
By the way, there is very little benefit these days in booting off instance store, compared to the benefits that EBS provides (start/stop, snapshots, resizing, etc).

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 .

What is the difference between Amazon AMI and EBS snapshot

My basic need is that I should be able to make new instance from my saved image for current running Centos with all settings.
I am thinking of two options:
Create the AMI from the any state
Create the snap shots of EBS
I am confused what is the differnece between them. Are they same or different?
Can I make new instances from EBS snapshots/?
Also, can I use AMI on my localhost to create the same OS?
There are two types of AMIs/instances: EBS boot and instance-store (sometimes referenced as S3-based). You are probably using EBS boot, so this answer will relate to that type.
An EBS boot AMI is an EBS snapshot of a boot EBS volume with some extra attributes including:
Registered as an AMI with an AMI id
AKI (kernel)
ARI (ramdisk)
architecture (e.g., 64-bit)
block device mappings (e.g., where volumes should be created/attached)
description, name
permissions (who is allowed to run the AMI)
If you create an AMI of the running instance, you should be able to start new instances in the same state. Make sure you test this process so that you know it works.
If you simply snapshot the EBS volume(s) of your running instance, you will be able to create volumes from those snapshots to access the configuration and data.
It is also possible to take an EBS snapshot of an EBS boot volume and register it as an EBS boot AMI so that you can run more instances starting with that state. When registering the AMI, you'll need to specify the correct AKI, architecture, and other meta-data in order for this to work, so research and practice before you trust this approach.
It took me a while to understand it as I am new with it, but here is a thing if you are using EBS backed:
If you want to start immediately create AMI Image( which creates image of OS and store data as EBS Snapshot), then the whole AMI Image contains current state of your instance which is installed OS which is all config and data files.
If you only take EBS snapshot, then for restore you need to launch new AMI, and you can attach this volume to it for just to access data. If your new AMI has different OS or upgraded may be few of your config won't work and you need to install your packages from scratch. So you should check this first.
In simple words EBS Snapshot can not be used as root volume unless you make and own its AMI image :-)
In brief, EBS boot AMI = EBS root volume snapshot + metadata
For better understanding, you can play it through hands on.
create an EBS snapshot for a particular running instance.
Find this snapshot.
Fill some meta data, and build image(AMI)
You did it. A brand new AMI has been created.