A brief introduction to Systems Manager and EC2 instances + EC2 Auto Scaling


AWS Systems Manager is in essence an ITOM tool.
It lets us automate lots of operational tasks across our AWS resources.
Below #2 features a selection of tools AWS provide - such as patch or session manager.



EC2 instances in AWS is where, as a cloud newbie, you'll do lots of your learning. The above diagram shows us several of the prerequisites we need in place when summoning an instance, along with some additional options such as user data (aka bootstrapping). With many different instance profiles available, it's also worth bearing in mind what is the best fit for your needs.   





As EC2 instances can be in several different states, it's important we understand what properties persist and which are merely ephemeral. It is best practice that EC2 instances are considered to be ephemeral resources as this allows many of the core tenants of the Well Architected Framework (WAF) to be achieved. There are several reasons for this;
  • Automatic scaling - you can add new instances as your application requires it.
  • Cost savings – no more guessing about capacity, deploy EC2 instances when usage demands.
  • Downgrading – if your business application is seasonal, you can amend your type of instance to match your requirements for this period. 
  • Repairing impaired instances – sometimes the underlying hardware EC2 instance run on fail, the ability to boot a new instance lets you immediately run your application on healthy infrastructure.
  • Upgrading – you simply want to update your AMI to ensure compliance or security hardening!
If you're not too sure about managing things on an EC2 instance, AWS provide Elastic Beanstalk. Which allows you to upload your application code wherein AWS will automatically take care of everything else including provisioning resources, load balancing and automatic scaling.
  • Amazon Route 53 is a DNS service which helps scaling by providing a level that spans AWS regions.
  • Elastic Load Balancers are virtual load balancers that automatically distribute incoming traffic across multiple targets, like EC2 instances, containers, IP addresses, and Lambda functions.
  • An Amazon EC2 Auto Scaling group contains a collection of EC2 instances. These instances are treated as a logical grouping for the purposes of automatic scaling and management.


ELB uses monitoring tools to determine the health of your implementation. The example below shows how an Application Load Balancer for the example.com website might work. The load balancer is the single point of contact for all clients. As the single point of contact it distributes all incoming application traffic across multiple targets.

  • Each listener checks for connection requests from clients, by using the protocol and port that was configured.
  • The listener forwards requests to one or more target groups, based on the defined rules.

Each rule specifies a target group, condition, and priority.
  • When the condition is met, the traffic is forwarded to the target group.
  • You must define a default rule for each listener, and you can add rules that specify different target groups based on the content of the request.
  • This configuration is also known as content-based routing. Each target group routes requests to one or more registered targets, such as EC2 instances, by using the protocol and port number that you specify.
  • You can register a target with multiple target groups.
  • You can configure health checks on a per target group basis.

Health checks are performed on all targets registered to a target group that is specified in a listener rule for your load balancer. As the diagram implies (above the example.com), you can register a target with multiple target groups.

Changes can be triggered to an Amazon EC2 Auto Scaling group in two basic ways.

  • Scaling policy defined on CloudWatch alarm - for example, Average CPU Utilization > 50 percent for 2 minutes—that calls an Amazon EC2 Auto Scaling policy.
  • Scheduled action - Scheduled actions allow us to set a new capacity value for a specific date and time, which can be reoccuring. This is ideal for anticipated traffic spikes.

Amazon EC2 Auto Scaling supports the following types of scaling policies:

  • Target tracking scaling adjusts the group's capacity based on a specified metric, similar to a thermostat maintaining a set temperature, with Amazon EC2 Auto Scaling handling the monitoring and adjustments.
  • Step scaling modifies group capacity through a set of scaling adjustments triggered by alarm breaches, without cooldown periods, making it suitable for dynamic changes based on variable conditions.
  • Simple scaling involves adjusting group capacity based on a single scaling adjustment.

It is also worth noting that EC2 Auto Scaling only works horizontally.

EC2 Auto Scaling lets us engineer highly available applications, whilst automatically adding or removing EC2 instances according to conditions we define.

  • Amazon EC2 Auto Scaling consists of three parts:
    • Launch configuration or launch template
    • Auto Scaling group
    • Scaling policies

  • Scaling can be based on:
    • Instance health
    • Amazon CloudWatch alarms
    • Time schedule or past usage (prediction)

  • To create a launch configuration, specify:
    • AWS Identity and Access Management (IAM) roles
    • Security groups
    • Storage

Thrashing is the excessive use of a computer's virtual memory, hindering its ability to meet application resource needs. This is something that can happen when using automatic scaling. If we have too many rapid and successive instance additions or removals, it can cause this malfunction.

You may also wish to intervene before an Amazon EC2 Auto Scaling action adds to or subtracts from your Auto Scaling group. Lifecycle hooks give you this flexibility. This could be to do some manual configuration before the instance is added to an Auto Scaling Group, or if scaling-in, simply to retrieve any logs prior to shutdown if this hasn't been automated.

Popular posts from this blog

Network Fundamentals for the Cloud

Familiarizing with the Command Line Interface

Security Fundamentals for the Cloud

CLI Fundamentals for the Cloud

DataDog, a Cloud Analytics & Monitoring application

A brief introduction to Databases and MySQL

AWS CodeCommit + Creating a CI/CD pipeline

Future Orientation: Tips from a AWS re/Start Graduate

A brief introduction to AWS Cloud Adoption Framework (CAF) and Well-Architected Framework (WAF)

Building a VPC in AWS