Working with ECS container instance without the EBS - amazon-web-services

I am using the free tier of AWS. I am experimenting with ECS and am following the article http://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_container_instance.html to create an ECS instance. One this I noticed is that using the community image amzn-ami-2016.03.e-amazon-ecs-optimized adds an EBS volume which cuts into my free tier usage. My question is, is this EBS volume required and can I do it without the EBS volume?

Any EC2 instance would need a Root volume at the very least to start the OS. All volumes in AWS are EBS volumes. So if you were wondering if you can have an EC2 instance without EBS, I don't think that is possible.
However, you can still reduce your EBS cost. It costs 10 cents per GB per month for an EBS volume. If you would notice, all Amazon ECS optimized EC2 instances are configured to use 30GB of EBS volume storage. That means you pay $3.00 extra per EC2 instance for a month! 8 out of that 30 GB is for Root, and 22 out of 30GB is for docker use.
Source:
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-ami-storage-config.html
By default, the Amazon ECS-optimized Amazon Linux AMI ships with 30
GiB of total storage. You can modify this value at launch time to
increase or decrease the available storage on your container instance.
This storage is used for the operating system and for Docker images
and metadata. The sections below describe the storage configuration of
the Amazon ECS-optimized Amazon Linux AMI, based on the AMI version.
Of course, you don't need the full 8GB for Root and full 22GB for docker. So you can lower your cost by reducing the size of those volumes to say 2GB for Root and 2GB for docker use. Then you would be paying 40 cents per month, and not $3.00.
Reducing volume size, as far as I know, is not easy.
Since that is out of scope for this question, I will just provide this link for interested parties.
Now that you are aware that there are 2 volumes used by ecs optimized instances, there is a way for you to NOT use the 22GB volume at all, and simply use the Root volume for docker storage. This too is not easy but can be done by creating your own AMI with docker and ecs agent installed. Then you will have to configure your docker to use the Root volume instead of the other one. Here is a thread which slightly discussed this issue.

For AWS ECS there is no additional charge for Amazon EC2 Container Service. You pay for AWS resources (e.g. EC2 instances or EBS volumes) you create to store and run your application. Free tier in AWS https://aws.amazon.com/free/ only Amazon EC2 Container Registry is part of free tier which offers 500 MB for storage.
And also if you are creating ECS containers from amzn-ami-2016.03.e-amazon-ecs-optimized AMI the volumes will be EBS so you will have to pay for EBS volumes.

Related

How to configure MariaDB(self hosted in EC2) storage on an EBS volume?

I have installed MariaDB on an EC2 instance. EC2 instance is small in size as our product is in development phase and we have very less traffic.
I want to keep an EBS volume for MariaDB data storage, so that as our traffic increases we can attach the EBS volume to a bigger EC2 instance and my data get transferred automatically.
Is keeping data storage on EBS(network) is a good approach? Will it not lead to more latent read/write?
If it won't impact my performance, what is the way to configure it?
An EC2 instance is made of 2 things - Compute & Storage.
Storage is basically an EBS volume (kind of Hard Disk of your laptop) that includes your OS files as well as other files for the software installed on your EC2.
Since, you are running your database on an EC2 instance, this EBS volume will also store your MariaDB database files on the same EBS where your OS is installed. It is not like, you can store MariaDB data on some other EBS.
So, when your data grows, you can expand EBS volume of your existing EC2 instance. You can follow this tutorial to learn how to do that - Increase the size of an Amazon EBS volume on an EC2 instance
Second thing is about performance. If your traffic increases, and you feel, you need more processing power (RAM or CPU), in that case you can upgrade your instance family. Refer this to see how to do that - Change the instance type.
Recommendation
As you will be spending a fixed monthly cost to run the EC2, my recommendation would be to use Aurora Serverless v2 with minimum capacity you need initially. Later, it can automatically scale itself when the traffic grows.

Amazon EC2 1 GB of Amazon Elastic Block Storage snapshot storage being used quickly

It seems that my EC2 usage limit is being reached rather quickly. I have deleted all of my EC2 instances and most of my S3 buckets, and none of my EC2 instances even exist in the terminated state. Are there any other services other than EC2 that use the EBS storage? Thanks in advance.
Amazon EBS is only used by Amazon EC2 instances. (Well, it is also used by Amazon RDS, but it shows up as an RDS charge, not EBS.)
We are currently about a third of the way through the month, so you'd want to be around 30% of usage.
The Amazon EBS snapshot usage is ahead of that (58%). If this worries you, then you can delete snapshots under the Snapshots section in the EC2 console. Amazon Machines Images (AMIs) also use EBS snapshots, so check the Images section too.
The amounts are "growing" because they are based on a month of usage. So, 1GB for 1 day is ~ 3% of the month's total.
However, there is little need to panic — EBS Snapshots are charged at 5c/GB/month, so at the current rate of usage you might be charged 10c.
There can be another possibility where you run an instance with EBS volumes 'not deleted' even after the termination of instance, it can accrue storage charges also. So delete those ones also in the 'Volumes' section of EC2 instance if its still unused.

AWS - EBS Snapshots is exceeding free tier

2 months ago I started using AWS and now I am having an issue with the Free Tier.
I installed a system with the elastic beanstalk tool (1 EC2 and 1 RDS).
Now I am seeing in Management Dashboard that I will be exceeding my monthly limit for EBS Snapshots. The forecast is 194.94% and I am just starting the month.
I reviewed all the settings and I couldn't find anything strange.
EC2
1 Running instances
1 volumes
2 Key Pairs
1 Elastic Ips
1 Snapshots
By looking the volume menu in AWS, the Snapshot id in the only volume that I have is not the same as the snapshot that I have. This is strange.
volume information:
Volume ID --> vol-0cff610c
Size --> 8 Gib
Volume type --> gp2
IOPS --> 100 / 3000
Snapshot --> snap-04786
State --> in-use
And in the snapshot menu, the volume id is not the same as the volume that I have in the other view.
Snapshot Information
Snapshot ID --> snap-0d2988
Size --> 8Gib
Volume --> vol-05f5fee
Status --> completed
Does anybody have an idea of what is causing this problem with the EBS?
Thanks!
Firstly, don't panic. EBS Snapshots are 5c/GB/month. Worst case, 8GB = 40c/month.
Secondly, if you don't want a snapshot, just delete it. Especially if you don't remember making it, and don't need to keep it.
Elastic Beanstalk can create AWS resources and terminate them automatically for you, depending on your workload.
If your server was under heavy workload at some point, Elastic Beanstalk could have provisioned auto scaling group with Elastic Load Balancer, and the number of EC2 instances can increase to cater for the increased workload.
As the workload drops, it can terminate the instances for you as well. Resulting in left-over snapshots, especially if you code writes to the local EC2 hdd.
Elastic Beanstalk is the "one-click" solution for deploying scalable clusters of servers.
Similar services are as follow :
Elastic Beanstalk (easiest)
OpsWorks
Cloud Formation (hardest)
LightSail is not included here as it doesn't really scale automatically. Lambda is serverless so it is fundamentally different.
today I reviewed again the information and AWS console.
My problem was that I have an unused AMI and the snapshot was related to that AMI.
I thought that the only AMI I had was being used by the instance. But I was wrong, the AMI used in the instance was a different one. Probably because I started my instance with elastic beanstalk.
So the solution was to deregister this unused AMI, then delete the Snapshot.
Thanks to all

Increase EBS Volume size of AWS Lightsail

I want to increase 80 GB Storage of AWS Lightsail max plan. Can I increase that?
Currently there is no way to increase the storage in the max plan. Unlike EC2, in Lightsail you have to upgrade the bundle to get more storage and you are already at the maximum bundle.
aws lightsail get-bundles
lists your bundle as the max. So there is no way to increase the storgae beyond 80GB. You have to choose EC2 service for your needs. Lightsail is not the solution for your needs. At this time, there is no way to launch an EC2 instance from your Lightsail snapshots.
Updated:
As of November 2017, you can now attach up to 15 additional disks to an instance. These are EBS General Purpose SSD (gp2) volumes, priced around $0.10 per GB-month.
Source: https://serverfault.com/questions/820465/aws-attach-ebs-to-lightsail-instance

Cost of storing AMI

I understand Amazon will charge per GB provisioned EBS storage. If I create AMI of my instance, does this mean my EBS volume will be duplicated, and hence incur additional cost?
Is there other cost charge in creating and storing an AMI (Amazon Machine Image)?
You are only charged for the storage of the bits that make up your AMI, there are no charges for creating an AMI.
EBS-backed AMIs are made up of snapshots of the EBS volumes that form the AMI. You will pay storage fees for those snapshots according to the rates listed here. Your EBS volumes are not "duplicated" until the instance is launched, at which point a volume is created from the stored snapshots and you'll pay regular EBS volume fees and EBS snapshot billing.
S3-backed AMIs have their information stored in S3 and you will pay storage fees for the data being stored in S3 according to the S3 pricing, whether the instance is running or not.
In this case, you will pay for the size of the storage used, instead of the storage provisioned. Snapshots will not store any empty blocks.
In short, yes, you will incur additional charges, but at a less rate, namely, EBS snapshot storage rate. Provisioned EBS is the 'live' HD that will be charged at $0.10 per GB per month if using standard SSD (gp2, USA east pricing for 2022 used throughout). And if you provisioned 50 GB, you will be fully charged for that 50 GB, even if you are only using 5% of it. The charges will incur even if you forget to attach to an EC2 instance. $5 per month in this case.
When you create an AMI, AWS will create a snapshot in the background. This snapshot is viewable under EBS Snapshots and will not be deletable as long as that AMI is in existence. You will get an error if you try to delete this snapshot. Snapshots cost less than 'provisioned' EBS at $0.05 per GB per month, and since snapshots ignore empty blocks, it will be shrunk to used size, so if you are only using 5% of 50GB, the snapshot should only be around 2.5 GB. $0.13 per month in this case. No other charges.
If you are creating a lot of these, it can get expensive very quickly, so some people save these AMIs into S3, which is cheaper than EBS snapshots. This is somewhat advanced and as far as I know, it can only be done via AWS CLI, and not in the console. You use a command called aws ec2 create-store-image-task and you have to specify the destination bucket name, and make sure permissions for S3, EBS and EC2 will all allow it. More detail at the official AWS documentation. This would reduce the cost to about $0.023 per GB per month. There are other changes relating to this method, i.e. EBS Direct API, but it is not much and you can look it up in the documentations.
Recently in November 2021, AWS released archived function for EBS snapshots, which allows you to archive your snapshots for a minimum of 90 days for $0.0125. You do have to pay $0.03 per GB for restoring the data. However, this is designed for EBS backups (e.g. daily backups using snapshots) and you cannot archive an EBS snapshot that is associated with an AMI. You will get an error: Failed to archive snapshot... snap-xyz is in use by ami-123.
Below is an excerpt of an actual AWS bill that will explain it in a visual sense.