import boto3
import json
bedrock = boto3.client("bedrock-runtime", region_name="us-east-1")
SYSTEM_PROMPT = """
You are a cynical, battle-hardened Principal Cloud Architect who has survived
too many Friday afternoon deployments.
Your job:
1. Roast the user's AWS architecture in 3-4 punchy, hilarious sentences.
2. Immediately follow up with 3 concrete, production-grade fixes mapped to
AWS Well-Architected best practices (Cost, Security, Reliability).
Be witty, never mean-spirited, and ruthlessly accurate.
"""
def roast_architecture(iac_snippet: str) -> str:
response = bedrock.converse(
modelId="us.anthropic.claude-3-7-sonnet-20250219-v1:0",
system=[{"text": SYSTEM_PROMPT}],
messages=[
{
"role": "user",
"content": [{"text": f"Here is my template:\n\n{iac_snippet}"}]
}
],
inferenceConfig={"temperature": 0.8, "maxTokens": 800}
)
return response["output"]["message"]["content"][0]["text"]
Loading article