Deploy Infrastructure

In this step, we will use AWS CloudFormation to automatically provision all infrastructure resources required for “The Cozy Brew” coffee ordering system.

The CloudFormation template (event-driven.yaml) will create:

  • Amazon S3 Bucket: Configured for public Static Website Hosting.
  • Amazon SNS Topic: Named CoffeeOrders.
  • Three Amazon SQS Queues: BaristaQueue, VIPExpressQueue, and BaristaDLQ (Dead-Letter Queue).
  • SQS Queue Policy: Granting permission for SNS to publish messages to the queues.
  • AWS Lambda Function (order-publisher): Integrated with a public Function URL (CORS enabled) to receive orders from the website and publish events to SNS.
  • AWS IAM Role: Granting basic execution permissions and sns:Publish access.
  • Two Pre-Configured Subscriptions: BaristaQueue (receives all orders) and VIPExpressQueue (only receives orders with quantity >= 5).
  • Redrive Policy: Automatically connecting BaristaQueue to BaristaDLQ (maxReceiveCount = 3).

Download the CloudFormation Template

You can download the template directly from the attachment below:

Upload CloudFormation Template


Deploy Stack via AWS Management Console

  1. Sign in to the AWS Management Console.
  2. In the search bar, type CloudFormation and select CloudFormation. Ensure you are in the Singapore (ap-southeast-1) Region.
  3. In the CloudFormation interface, click Create stack (select With new resources).
  4. Under Prerequisite - Prepare template, select Template is ready.
  5. Under Specify template, select Upload a template file, click Choose file, and select the downloaded event-driven.yaml file. Then click Next.

Upload CloudFormation Template

Upload CloudFormation Template

Upload CloudFormation Template

Upload CloudFormation Template

  1. On the Specify stack details page:
    • Stack name: Enter aws-event-driven-architectures.
    • Click Next.

Specify Stack Details

  1. On the Configure stack options page, keep all default settings. Scroll to the bottom and check the acknowledgment box:
    [x] I acknowledge that AWS CloudFormation might create IAM resources.

Acknowledge IAM Resources

  1. On the Review and create page:
    • Review the configured components.
    • Click Submit (or Create stack).

Acknowledge IAM and Create Stack


Verify Stack Creation and Inspect Outputs

  1. The initial stack status will be CREATE_IN_PROGRESS. Since all resources are Serverless, creation completes very quickly (typically in 30 to 60 seconds).
  2. Wait until the status transitions to green: CREATE_COMPLETE.

Stack Creation Complete

Stack Creation Complete

  1. Click the Outputs tab of the stack to inspect the created resources:

Stack Outputs Tab

Output Key Description Usage
WebsiteURL S3 Static Website Hosting URL Link to access the coffee shop web interface
S3BucketName S3 Bucket Name Destination bucket to upload the index.html interface file
OrderApiUrl Lambda Function URL Order ingestion API endpoint to connect to the website
CoffeeOrdersTopicArn SNS Topic ARN Unique identifier of the CoffeeOrders topic
BaristaQueueUrl SQS BaristaQueue URL Queue receiving all coffee preparation orders
BaristaDLQUrl SQS BaristaDLQ URL Dead-Letter Queue isolating failed orders after 3 retries
VIPExpressQueueUrl SQS VIPExpressQueue URL Queue receiving high-volume bulk orders (Quantity >= 5)

Keep this Outputs tab open in your browser, as you will need the WebsiteURL, S3BucketName, and OrderApiUrl values in the next step.