Skip to content

Workflows — Connecting Services

Real applications connect multiple AWS services. This guide walks through a complete order-processing flow built entirely in Floci: SQS triggers Lambda, Lambda persists to DynamoDB and notifies via SNS.

Producer → SQS queue → Lambda → DynamoDB table
└──► SNS topic → (email / webhook)

You can build this manually in the UI, or let your AI agent do it in one conversation.

You: Build me an order processing pipeline:
- An SQS FIFO queue called "orders"
- A DynamoDB table called "order-records" with orderId as partition key
- An SNS topic called "order-notifications"
- A Python Lambda called "process-order" that reads from the queue,
writes the order to DynamoDB, and publishes to the SNS topic
- Tag everything with Project=order-service
Claude:
1. create_sqs_queue(name="orders", fifo=True)
2. create_dynamodb_table(name="order-records", partition_key="orderId")
3. create_sns_topic(name="order-notifications")
4. create_lambda_function(name="process-order", runtime="python3.12", ...)
5. tag_resources(resource_arns=[...], tags={"Project": "order-service"})

The agent wires everything together and returns the ARNs.

Go to SQSCreate Queue:

  • Name: orders.fifo
  • Type: FIFO
  • Content-based deduplication: enabled

Go to DynamoDBCreate Table:

  • Name: order-records
  • Partition key: orderId (String)

Go to SNSCreate Topic:

  • Name: order-notifications
  • Type: Standard

Go to LambdaCreate Function:

  • Name: process-order
  • Runtime: Python 3.12
  • Handler: index.handler

Use this inline code:

import json
import os
import boto3
ENDPOINT = os.environ.get("AWS_ENDPOINT_URL", "http://localhost:4566")
REGION = os.environ.get("AWS_DEFAULT_REGION", "us-east-1")
CREDS = {"aws_access_key_id": "test", "aws_secret_access_key": "test"}
dynamo = boto3.resource("dynamodb", endpoint_url=ENDPOINT, region_name=REGION, **CREDS)
sns = boto3.client("sns", endpoint_url=ENDPOINT, region_name=REGION, **CREDS)
TABLE = dynamo.Table("order-records")
TOPIC_ARN = os.environ["SNS_TOPIC_ARN"]
def handler(event, context):
for record in event.get("Records", []):
body = json.loads(record["body"])
order_id = body["orderId"]
TABLE.put_item(Item={"orderId": order_id, "status": "received", **body})
sns.publish(
TopicArn=TOPIC_ARN,
Message=json.dumps(body),
Subject=f"Order {order_id} received",
)
return {"statusCode": 200, "processed": len(event.get("Records", []))}

Add an environment variable SNS_TOPIC_ARN with the ARN of your order-notifications topic.

Go to SQS → select orders.fifoSend Message:

{
"orderId": "ord-001",
"customerId": "cust-42",
"items": [{ "sku": "WIDGET-A", "qty": 3 }],
"total": 59.99
}

Go to Lambda → select process-orderInvoke with the SQS event shape:

{
"Records": [{
"body": "{\"orderId\":\"ord-001\",\"customerId\":\"cust-42\",\"total\":59.99}",
"messageId": "abc-123",
"receiptHandle": "abc-123"
}]
}

Go to DynamoDBorder-recordsScan — you should see the order item.

Go to Lambda → select process-orderLogs tab to see the CloudWatch output.

To trigger Lambda automatically on new queue messages (vs manual invoke), use the MCP:

You: Wire the "orders.fifo" queue as a trigger for the "process-order" Lambda
Claude: [calls run_local_aws_cmd(
"lambda create-event-source-mapping "
"--function-name process-order "
"--event-source-arn arn:aws:sqs:us-east-1:000000000000:orders.fifo "
"--batch-size 10"
)]

Add an email subscription to see the SNS publish in action (requires Mailpit):

  1. Deploy Mailpit from the Marketplace
  2. Go to SNSorder-notificationsSubscribe
  3. Protocol: email, Endpoint: dev@localhost
  4. Open http://localhost:8025 (Mailpit) to see incoming emails

Once the flow works locally, export it:

You: Export the order-service resources to Terraform
Claude: [calls find_resources_by_tag(tag_key="Project", tag_value="order-service")]
[calls export_to_terraform()]

The generated HCL includes all tagged resources ready for a real AWS account.