The Simplest Way to Make Azure Service Bus and Ec2 Systems Manager Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Using azure service bus and ec2 systems manager together lets messages trigger host actions across clouds. One tool holds events in a queue while the other runs tasks on servers. Teams with apps in both clouds often need this link. A web app in Azure can drop an alert into a message queue. A worker then reads that message and tells AWS to patch a server or restart a process. When set up well, this path removes manual steps for engineers. It also keeps each cloud role small and safe. How azure

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

Using azure service bus and ec2 systems manager together lets messages trigger host actions across clouds. One tool holds events in a queue while the other runs tasks on servers.

Teams with apps in both clouds often need this link. A web app in Azure can drop an alert into a message queue. A worker then reads that message and tells AWS to patch a server or restart a process. When set up well, this path removes manual steps for engineers. It also keeps each cloud role small and safe.

How azure service bus and ec2 systems manager pass data and roles

Data moves between these two tools through a middle worker app. Azure Service Bus stores messages in queues or topics until a reader pulls them. That reader app checks the message body and decides what server task to run next.

To read from the queue, the worker needs an Azure identity or a shared key. Using a workload identity is safer than storing long-lived keys on a disk. The identity gets a read-only role scoped to one single queue or topic.

Once the worker reads the event, it calls the AWS API to run a task. It logs in to AWS using a short-lived role token from an identity provider. Then EC2 Systems Manager takes that call and sends the command to the right host. The host runs an agent that checks for new tasks and reports the output back.

Common failure modes and how to scope roles

Many teams start by sharing one broad service account across all workers. If an attacker steals that key, they can read every queue and control every server. Long-lived static keys in app settings also create a high risk during leaks.

Another common trap is giving the AWS role full admin rights over all instances. A bad message in the queue could then wipe or stop the wrong servers. Unlogged runs also hurt teams when a script fails and nobody knows who triggered it.

Service-to-Service Authentication + Azure RBAC: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

To fix this, give each queue reader its own small role. In Azure, grant pull rights only to the exact queue the worker needs. In AWS, tag your servers by team or app name. Set up the role rule so EC2 Systems Manager can only touch hosts with matching tags.

Keeping network paths and audit logs clean

Good network rules stop bad traffic before it hits your servers. You do not need to open public ports on your AWS hosts for this workflow. The host agent reaches out to the AWS service over a safe outbound path.

Keep your worker app inside a private network segment with strict egress rules. It only needs to reach the Azure message endpoint and the AWS API endpoint. Block all other outbound web traffic from that worker host.

Turn on full logs in both cloud platforms before you run tasks in production. Log every message pull in Azure and every command start in AWS. Send the command output to a central log bucket so engineers can check failures fast. Make sure your log tool rewrites emails, phone numbers, or card numbers in the output.

Check database and API queries on the wire

Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.

Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.

Frequently asked questions

Can Azure Service Bus call EC2 Systems Manager without a worker app?

No, the message queue only holds and delivers data. You need a small function or worker service to read the message and call the AWS API.

How do we avoid storing static cloud keys in the worker?

Use workload identity federation between Azure and AWS. This lets your worker trade an identity token for short-lived cloud roles at run time.

How can we limit which servers a queue message can change?

Put clear tags on your AWS hosts and lock down the worker role. Allow commands to run only when the server tag matches the allowed rule.

The query runs. The emails stay hidden.