Amazon Elastic Compute Cloud – EC2


Elastic Compute Cloud (EC2) refers to compute (server) resources. In AWS, servers are called Amazon EC2 instances or just “instances”. You can install application instances, web instances, database instances, gaming instances, mail instances, media instances, catalog instance, file instance, computing instance, proxy instances and so on. You can configure one to your own liking of procure an instance configured by someone else.

EC2 instances can be auto scaled. This means that when you need more server, you procure more within minutes, and when you no longer need the extra instances, you can simply shut them down. You only pay for what you use. Auto scaling can also be configured with some logic. For example, you can configure your account to spin up a new EC2 instance if existing instances are facing 90% or higher consecutive load over 5 minutes. You can launch one or any number of instances. Built-in limits exist but usually the limit is your affordability

You can gain access to virtual machines (instances) in EC2. You can choose from any non-obsolete version of Linux or Windows OS. You can choose between Xen or Nitro hypervisor.

For your EC2 instance, you can choose from any packages (combination of CPU, memory, disk, and IO). Alternately, you can choose bare metal which is physical hardware instead of shared hardware which is offered by default.

AWS offers a large selection of AMI’s to choose from. An Amazon Machine Image (AMI) is a packaged environment containing a software stack along with its dependencies that are necessary to set up an EC2 instance. It is the basic unit of deployment. You can create your own AMI or use a prepackage AMI created by a commercial organization or a community. AWS marketplace offers canned solutions. If you need particular software to solve specific type of problem. AMIs are provided by Amazon, trusted publishers, community, and AWS marketplace. Every instance begins with an AMI. AMI is a bit-for-bit copy of the root: e.g. RHEL 9.1, Windows 10

There are different billing models: on-demand, reserved instances, spot market for EC2 instances. Hourly fee includes OS license.

Physical components of a machine are rack, chassis, switch, power, cooling, server hardware, Intel Xeon processors, Hypervisor, etc. Instances share phyiscal resources. Dedicated instances reserve physical machines. Amazon is responsible for physical components. Client is responsible for everything on an EC2 instance.

EC2 instances have many use cases such as enterprise applications, web servers, relational databases, NoSQL datastores, video transcoding, batch processing, container orchestration, code repositories, build servers, etc. EC2 instances should be designed for failure meaning you should consider EC2 instances to be disposable. You don’t make configuration changes to your EC2 instances. Instead modify your AMI so that you can simply spin up now EC2 instances with updated instructions. Use automated deployments. Treat logas a streams. Monitor your instances with CloudWatch. Enable auto-scaling not only to optimize usage but also for self-healing i.e. the system with automatically discard instances with problems.

EC2 instance can be hosted globally. AWS has data centers across the globe. If your primary market is Europe, you probably would not want to host your EC2 instances in Australia.

EC2 instances have IP addresses assigned to them. In the cloud, we spin up new instances on the fly. To efficiently deal with these changes, elastic IPs are used. They are not dynamic addresses assigned to your account. EC2 instances are accessed through these elastic IP addresses.

Bootstrapping refers to creating a repeatable process that can run independently to get an application up and running on an EC2 instance. This could, for example, involve installing dependencies, pulling code from GIT, deploying, and startup.

See https://canacoder.com/how-to-setup-and-configure-an-ec2-instance/ for detailed instructions on creating an EC2 instance.