Stay elastic with AWS ECS Service Autoscaling

In this post, I show how your application running in ECS withstands load peaks automatically. Everything can be managed in infrastructure as code(IaC) setup via terraforming.

What is ECS Autoscaling?

It’s the ability to adjust the desired count of tasks in your ECS service.

How does it work internally?

AWS uses Cloudwatch metrics to check the average CPU/Memory of your tasks to increase the desired count value. You can also use these metrics to decrease the desired count to save money during low usage times. ECS sends metrics every minute to Cloudwatch.

Types of autoscaling

  • Target tracking -> Based on metrics
  • Step scaling -> Not recommended by AWS
  • Scheduled scaling -> Based…

Finally it is possible to connect via CLI to your running containers in AWS ECS Fargate/EC2 via the AWS CLI/API. No matter if your ECS cluster runs in a private subnet or not. No bastion/jump host is necessary. At the moment only the newest 1.* AWS CLI release has the new aws ecs execute-command on board. AWS CLI Version 2 will get an update in the next weeks.

Enable the ExecuteCommandAgent on the ECS Service

First off all we need to enable the agent on the ECS service to accept commands. This can be done with the AWS CLI like this:

aws ecs update-service --cluster nginx-cluster --service…

Master and secondary replica RDS instances

In this post we take a look what AWS RDS offers to be a high performant and resilient database system. RDS has two capabilities called Multi AZ and read replicas to get this done.

What means multi AZ on RDS?

  • Feature to keep your database service running and make it resilient
  • Another RDS instance(replica) gets configured to work in another availability zone but in the same region as your primary instance
  • Basically it’s a failover option for your primary RDS instance
  • It’s not a read replica!
  • Data replications works synchroniously between availability zones
  • MySQL, Oracle, PostgreSQL and MariaDB support failover mechanism that is managed completely by…

You covered your codebase with unit tests but you’re still facing some weird bugs from time to time and don’t know how to find the issues in your web application, serverless endpoint or cron job script? This post will guide you through the pain of setting up debuggers in your IDE and describes how a debugger works in detail.

All the code used in this post can be found here:

What is debugging?

Debugging means to find a bug/anomaly in your code/program. Normally you can use a debugger to start your program in a monitoring mode to see what happens by stepping…

Access an EC2 Instance via SSH in a private VPC subnet

You want to check services running in a private subnet in your VPC on AWS, or just want to play around with the shell on a small instance on your private network? This guide shows you how to access an EC2 instance on a private subnet within your VPC via SSH:

  1. Launch an EC2 instance

What do we build?

In this post we’re gonna implement a search as you type feature with Symfony. We will feed product information into Elasticsearch, build a user interface to search for a product by it’s title and manage the Symfony integration to query Elasticsearch.

What is Elasticsearch?

Elasticsearch is an open source search and analysis engine based on Apache Lucene developed in Java. Feed it with your data using a REST interface and explore it with powerful queries and aggregation possibilities. Use it as a base for analytical dashboards or realtime systems.

Elasticsearch is designed as a distributed system from the ground up to build a…

Let’s checkout how to connect Symfony with Amazon SQS and SNS Services by using a Symfony component.

Github repo for this article:

What is the Symfony Messenger?

It’s a Message-Bus that can be used for the following design patterns:

  • Command-Bus
  • Query-Bus
  • Event-Bus

We are going to use a Command-Bus pattern that seperates the description, what needs to be done, from where it’s going to happen. It’s like getting an order in a restaurant that gets prepared in the kitchen. In our case we will create a TestMessage object, that gets send and consumed by a handler.

Setup the Symfony project:

Create a Symfony CLI skeleton:

docker run — rm…

Are you tired of storing a file with your application secrets in a password manager and need to copy it to your CI/CD environment everytime you change it to deploy your application in a security compliant way?

Spin up Symfony

Create a docker-compose.yml in your project root and add the following:

(See PHP Docker development with XDEBUG explained here)

version: '3'
image: webdevops/php-nginx-dev:7.4
working_dir: /app
- WEB_DOCUMENT_ROOT=/app/public

For applications it’s often really annoying to aggregate data in memory with a self written command/program instead of having this already done by the storage engine, which holds the data. The point is, it’s really cumbersome to fetch data from a database, aggregate it within a program and write it to another table, which will be used as data source for another program. When you see something like this, please always try to get rid of this aggregation work and let your storage engine handle it. So let’s clearify how materialized views can help in this situation.

What are Views?

First of all…

What is a Software Architecture Assessment?

It‘s much better to discover a missing bedroom while the
architecture is just a blueprint, rather than on the moving day (by Paul Clements)

In a software architecture assessment, you try to find problems within the architecture / implementation. When can you do that?

  • Finding bugs in an early state at time of design
  • During development to compare the implementation against the draft
  • For maintenance and further development reasons

In practice the assessment is done most of the time after the implementation is done and the project is already in production.

What is TARA?

The tiny architectural review approach(TARA) was invented for situations…

Stefan Pöltl

Software Architect

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store