user1259574
user1259574

Reputation: 101

Tomcat in AWS EC2 instance

I have a requirement of setting up Apache Tomcat on Amazon EC2 instance.

I have heard that EC2 is ephemeral and anything we put in may not survive restarts. So if I add a Tomcat in EC2 and restart the instance will it be deleted or removed.

What are the ways to overcome this issue ?

Sorry I am a newbie in AWS.

Upvotes: 0

Views: 1608

Answers (4)

Seth Bergman
Seth Bergman

Reputation: 426

Ephemeral disk is temporary storage that it is added to your instance and sized according to instance type. The larger the instance, the more temporary storage.

For some instances like c1.medium and m1.small they use instance storage automatically as SWAP as they have a limited amount of memory, while many others are automatically formatted and mounted at /mnt.

You can take snapshots of your EC2 instances while they are running. Snapshots allow you to create AMI's from your current machine state, which will contain everything in your ephemeral storage. When you launch a new instance based on that AMI, it will contain everything as it was in the snapshot.

An Amazon Machine Image (AMI) provides the information required to launch an instance.


Take note that there is a big difference between stop and terminate. If you stop an instance that is backed by EBS, the information on the root volume will still be in the same state when you start the machine again. If you terminate the machine without taking a snapshot, even if it is backed by EBS, the storage inside the ephemeral disk will be lost forever.

All AMIs are categorized as either backed by Amazon EBS or backed by instance store. The former means that the root device for an instance launched from the AMI is an Amazon EBS volume created from an Amazon EBS snapshot. The latter means that the root device for an instance launched from the AMI is an instance store volume created from a template stored in Amazon S3. For more information, see Amazon EC2 Root Device Volume.


The above answers should provide a good idea about what you can and cannot do with ephemeral disks, but I advise all (myself included) to learn more about ephemeral disks and their primary use cases.

Here are some good use cases for ephemeral storage that I know of:

  1. Temporary backup
  2. Re-format the original instance storage and use part of it for SWAP
  3. RAID 10 with 6 disks (4 EBS and 2 Ephemeral disks) to improve overall performance and provide HA
  4. Application cache, logs, any other random data

Upvotes: 1

akezzou
akezzou

Reputation: 11

If what you need is just Tomcat then you can use pre-configured Amazon Beanstalk Tomcat container which does exactly that.

However if you need to build custom EC2 you can install tomcat on EBS linked to EC2, or even better use Amazon EFS to share between multiple EC2.

Upvotes: 1

mferpan
mferpan

Reputation: 1

You only need storage to keep your information, EBS or S3. EC2 instances are virtual machines and will not lose your information if restarts with storage. Get all information you need at https://aws.amazon.com/es/ec2/

Upvotes: 0

Zgr3doo
Zgr3doo

Reputation: 1855

You are save as long as you not store it on ephemeral partition which is a part of your instance check this to have more info

http://www.heitorlessa.com/working-with-amazon-aws-ec2-ephemeral-disks/

basically you need to mount elastic drive to your instance and install Tomcat and all your software there, ephemeral storage is for swap or caching

Upvotes: 0

Related Questions