
My AI Agent Followed the Rule Because I Asked. Now It Has No Choice.
My agent's only-production rule was a sentence in its prompt. I moved it to a policy at the Gateway, and the same call for staging was refused.
14 posts

My agent's only-production rule was a sentence in its prompt. I moved it to a policy at the Gateway, and the same call for staging was refused.

I wanted a staging server that was more realistic than local Docker but smaller than a full AWS platform. I used Terraform and Docker Compose to build one on a $7 Lightsail plan, then measured deployment, application recovery, instance reboot recovery, cost, and cleanup.

I wanted a persistent Kubernetes environment without an always-on managed-cluster bill or compromising the Docker workloads already running on my Debian home server. I chose k3s, defined explicit resource boundaries, disabled components that conflicted with the host, and validated the design through deployment, networking, rollout, rollback, and desired-state checks.

My Terraform drift pipeline could detect an EC2 tag change and remove it automatically, but the evidence was scattered across temporary logs. I added a DynamoDB audit trail, a read only Lambda API, and a CloudFront dashboard so the system could remember and display every classified drift event.

I added a tag directly to an EC2 instance in AWS, then ran my Terraform drift detector. The change was classified as LOW, Lambda started a separate remediation build, and Terraform removed the tag automatically.

My Terraform drift detector could send an email, but it could not explain what changed or how serious it was. I changed the SNS message into structured JSON, delivered it to SQS for audit processing, and used Lambda to classify every resource change by severity.

Terraform could reproduce my infrastructure, but it could not warn me when someone changed AWS manually. I built a CodeBuild job that runs Terraform plan, handles the drift exit code correctly, reads shared configuration from SSM, and sends an SNS email when the real infrastructure no longer matches the code.

How to expose an ECS Fargate app publicly using an Application Load Balancer, target groups, and Terraform. Includes subnet AZ requirements and security group locking.

Containerizing My Three Tier App with GitHub Actions

One flat file works until it doesn't, here is how to fix that

Stop storing your state locally, here is the right way to do it on AWS

From invisible to observable: IAM, CloudWatch Agent, and SSM wired together with Terraform

I wanted to stop consuming Terraform modules and start writing them. The best way I know how to learn something is to build something real, break it, fix it, and understand why it works. So I sat down and built a full three tier AWS architecture from scratch, no copy paste, no AI, just me, the Terraform docs, and a lot of errors. Here is what I ended up with and what I learned along the way.

A hands on walkthrough of wiring S3 to Lambda and what I learned by intentionally breaking permissions to understand execution roles vs resource based policies.