Thursday, March 23, 2023

AWS Instance tenancy- Reserved and Spot instances

AWS Instance tenancy refers to how an Amazon Elastic Compute Cloud (EC2) instance is placed on the underlying physical host, and whether it is dedicated solely to the customer or shared with other customers.

Reserved instances are a way to save money on AWS EC2 instances by committing to a certain usage level over a one- or three-year term.

With reserved instances, customers can choose between three tenancy options:

  1. Dedicated Instance: A physical server that is dedicated to a single customer.

  2. Dedicated Host: An entire physical server that is dedicated to a single customer.

  3. Default tenancy: An EC2 instance that is shared with other customers on the same physical host.

Spot instances, on the other hand, are a way to purchase spare computing capacity at a discounted rate.

With spot instances, customers bid on unused EC2 capacity, and if their bid is above the current market price, they can use that capacity until the spot price exceeds their bid or they terminate the instance.

Spot instances are always launched as default tenancy, which means they can share the same physical host with other customers' instances.

In summary, the tenancy options for AWS EC2 reserved instances include Dedicated Instance, Dedicated Host, and Default tenancy, while spot instances are always launched as Default tenancy.

steps to create an AWS EFS volume and mounting the EFS volume to two instances.

 Here are the steps to create an AWS EFS volume and mount it to two instances:

  1. Log in to your AWS console and navigate to the EFS service.

  2. Click on the "Create file system" button.

  3. Select the appropriate VPC and subnet for your EFS volume.

  4. Choose a performance mode for your EFS volume. You can select either "general purpose" or "max I/O."

  5. Set the throughput mode for your EFS volume. You can select either "bursting" or "provisioned."

  6. Set the encryption for your EFS volume. You can choose to encrypt your data at rest or not.

  7. Configure the network settings for your EFS volume. You can choose to allow access from specific IP addresses or allow access from anywhere.

  8. Click on the "Create file system" button to create your EFS volume.

  9. After the EFS volume is created, navigate to the "Access Points" tab and click on the "Create Access Point" button.

  10. Set the name and permissions for your access point.

  11. Click on the "Create Access Point" button to create your access point.

  12. Navigate to the EC2 service and launch two instances in the same VPC and subnet as your EFS volume.

  13. SSH into each instance and run the following command to install the EFS mount helper:

sudo yum install -y amazon-efs-utils
  1. Create a mount point directory on each instance. For example, you can use the following command:
bash
sudo mkdir /mnt/efs
  1. Mount the EFS volume to each instance using the following command:
javascript
sudo mount -t efs -o tls fs-xxxxxxxx:/ /mnt/efs

Note: replace fs-xxxxxxxx with the file system ID of your EFS volume.

  1. Verify that the EFS volume is mounted on each instance by running the following command:
bash
df -h

You should see the EFS volume listed as a mounted filesystem.

Now, you have successfully created an AWS EFS volume and mounted it to two instances.

The EFS volume can be accessed from both instances, and any changes made on one instance will be visible on the other instance as well.

Amazon EFS volume

Amazon Elastic File System (Amazon EFS) is a fully managed, highly scalable, and highly available file storage service provided by Amazon Web Services (AWS).

It provides a simple and scalable file storage solution for use with Amazon EC2 instances in the AWS Cloud.

Amazon EFS is built on a distributed architecture that automatically scales storage capacity and throughput as needed.

It is designed to provide highly durable and highly available file storage with low-latency performance.

Amazon EFS supports multiple file systems and protocols, including the industry-standard Network File System (NFS) version 4.1 protocol.

It also supports encryption at rest and in transit, and integrates with other AWS services such as

Amazon CloudWatch and

AWS Identity and Access Management (IAM).

One of the main benefits of Amazon EFS is its ability to scale storage capacity and throughput automatically as your data grows, without the need for manual intervention.

This makes it ideal for use cases that require large-scale, highly available file storage, such as web serving,

content management,

data analytics,

and media processing.

Additionally, Amazon EFS is a fully managed service, which means that AWS takes care of the underlying infrastructure, including hardware and software updates, so you can focus on your applications and data.

how to you take backup of Amazon EBS

To take a backup of an EBS volume, you can use Amazon's Elastic Block Store (EBS) snapshot feature.

EBS snapshots are a point-in-time backup of the entire EBS volume and can be used to create new volumes, migrate data across regions, and provide data durability.

Here are the steps to take a backup of an EBS volume using EBS snapshots:

  1. Go to the AWS Management Console and navigate to the EC2 dashboard.

  2. Select the EBS volume you want to back up from the list of volumes.

  3. Click on the "Create Snapshot" button in the "Actions" dropdown menu.

  4. In the "Create Snapshot" dialog box, enter a meaningful name and description for the snapshot.

  5. Optionally, you can specify any tags you want to associate with the snapshot.

  6. Click the "Create Snapshot" button to initiate the snapshot creation process.

  7. Monitor the progress of the snapshot creation process in the "Snapshots" section under the "ELASTIC BLOCK STORE" category.

Once the snapshot creation process is complete, you can use the snapshot to restore the EBS volume to its state at the time the snapshot was taken.

You can also copy the snapshot to other regions or accounts, share the snapshot with other AWS accounts, or use it to create a new EBS volume.

Note that EBS snapshots are stored in Amazon S3, and you are charged based on the amount of data stored and the number of snapshots created. You can also set up automated snapshot creation using Amazon's EBS snapshot lifecycle policies to simplify the backup process.

Steps to create AWS EBS volume and Attaching the EBS volume with an EC2 instance

follow the below steps to create an AWS EBS volume:

  1. Log in to the AWS Management Console and go to the EC2 dashboard.

  2. Click on the "Volumes" option under the "ELASTIC BLOCK STORE" section in the left-hand navigation panel.

  3. Click on the "Create Volume" button.

  4. In the "Create Volume" dialog box, select the Region where you want to create the volume.

  5. Set the size of the volume, the volume type, and the IOPS (Input/Output Operations per Second) if applicable.

  6. Optionally, you can specify any additional settings such as encryption, tags, or availability zone.

  7. Click the "Create Volume" button to create the EBS volume.

Once the volume is created, you can attach it to an EC2 instance as needed.

To attach a volume, you need to

select the volume from the list of available volumes and

click on the "Actions" button, then choose "Attach Volume".

In the "Attach Volume" dialog box, select the instance to which you want to attach the volume,

specify the device name for the volume, and click "Attach".

After the EBS volume is attached to an EC2 instance, you can mount the volume and use it to store your data.