The Simplest Way to Make AWS Sqs Sns and Teamcity Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Combining aws sqs sns and teamcity lets your build servers and cloud apps exchange events. This setup triggers builds from cloud queues and sends build results to downstream topics. Teams use this link to decouple CI pipelines from production work. A build agent finishes a job and publishes a message to an SNS topic. One or more SQS queues receive that message and hold it for worker apps. In the other direction, an SQS queue can hold incoming build requests. A worker script reads the queue and

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.

Combining aws sqs sns and teamcity lets your build servers and cloud apps exchange events. This setup triggers builds from cloud queues and sends build results to downstream topics.

Teams use this link to decouple CI pipelines from production work. A build agent finishes a job and publishes a message to an SNS topic. One or more SQS queues receive that message and hold it for worker apps. In the other direction, an SQS queue can hold incoming build requests. A worker script reads the queue and starts a TeamCity build via its API.

How data and roles flow between aws sqs sns and teamcity

The link between your CI server and AWS relies on identity roles and permissions. TeamCity agents need cloud permissions to publish messages to SNS or read from SQS. The best method uses an IAM role attached to the build agent host. When the agent runs in AWS, it gets temporary keys from the instance profile. This avoids storing static keys inside your build project settings.

When TeamCity runs outside AWS, teams often set up identity federation with OpenID Connect. The build server exchanges a short token with AWS to assume a specific role. That role holds permissions to send messages to one SNS topic only. SNS then fans the message out to subscribed SQS queues across your cloud accounts.

Data flows in structured JSON payloads between the two systems. A finished build step runs a small script or notifier. It sends the build number, branch name, and status to the SNS topic. Downstream apps read the linked SQS queues at their own pace. If a downstream app fails, the message stays safe in the queue for another try.

Common failure modes and how to scope access

Many teams start by putting one shared IAM user key into the root project. Every build plan in the server can then read and use that same key. If that key has broad cloud rights, any developer can change production queues. A rogue build script could delete an SQS queue or read sensitive queue data.

Shared accounts also ruin your audit logs in AWS CloudTrail. Every call to SQS or SNS shows the same generic service user name. You cannot tell which project or developer sent a bad payload to a topic. When a queue fills with bad messages, finding the broken build takes hours.

AWS IAM Policies + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

To fix this, scope one IAM role to one TeamCity project. Write a strict resource policy on each SQS queue and SNS topic. Allow only the matching project role to publish or read messages. Turn on server encryption on both SNS topics and SQS queues using KMS keys. Grant key usage only to the specific build roles that need it.

Keeping sensitive data out of build messages

Build logs and event payloads sometimes carry secret values by mistake. A failed test output might include emails, phone numbers, card numbers, or national IDs. If TeamCity sends raw test logs to SNS, that data spreads to every queue.

Keep event payloads small and strict. Send only metadata like build IDs, commit hashes, and status codes through SNS. Let downstream workers fetch full artifacts from secure storage after checking their own permissions. Data masking tools can also rewrite matched fields like emails or card numbers in results. This stops sensitive strings from landing in shared message queues or chat alerts.

Network paths between your build agents and AWS also need clear rules. If your agents run in a private cloud network, use VPC endpoints for SQS and SNS. Traffic stays inside the cloud network and never crosses the public internet. Endpoint policies can further restrict which topics and queues your build subnet can reach.

Govern statements and responses across databases and APIs

Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.

First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

Should TeamCity push to SNS or directly to SQS?

Push build events to SNS first when multiple systems need the same update. SNS copies the event to several SQS queues so each app reads its own copy.

How do we stop builds from using static AWS keys?

Use IAM roles for EC2 on cloud agents or OpenID Connect for external servers. Both options give the build job short-lived tokens that expire right after the run.

What happens if TeamCity sends a bad message to SQS?

Attach a dead-letter queue to your main SQS queue to catch failed messages. After a set number of failed reads, SQS moves the bad message there for review.

The query runs. The emails stay hidden.