Skip to main content
Marcel Krčah

EC2 Application Load Balancer: Identifying clients by user-agents

Published on , in

EC2 Application Load Balancer supports storing HTTP access logs in S3. (These logs can be further analyzed in Athena and QuickSight). It turns out the access logs capture the user-agent request header. So if you want to know which service is behind the HTTP request, adjust the user-agent header in the service.

Here's an example from an AWS Lambda written in Typescript.

import got from "got" // https://github.com/sindresorhus/got
got("https://example.com", {
  headers: {
    "user-agent": `Service: foo`,
  },
})

This blog is written by Marcel Krcah, an independent consultant for product-oriented software engineering. If you like what you read, sign up for my newsletter