Accessing the Web UI
Swagger UI
Section titled “Swagger UI”The terraform-aws-ecs-express-mode-demo container exposes a Swagger UI at the /docs path. Once your Express Gateway Service
The aws_ecs_express_gateway_service Terraform resource that provisions an ECS service with managed ALB, auto scaling, and simplified configuration for HTTP/HTTPS web applications and APIs. is running and healthy, retrieve the URL and open it in your browser:
terraform output -raw web_ui_urlCopy the printed URL into your browser’s address bar. The root URL returns 404 by design — the demo serves its UI at /docs.
The Swagger UI provides an interactive interface for exploring and testing the API endpoints without needing a separate HTTP client. You can view request schemas, try out endpoints directly in the browser, and inspect response payloads.

Bedrock Image Analysis
Section titled “Bedrock Image Analysis”The demo application uses Amazon Bedrock
AWS fully managed service providing foundation models for generative AI applications. with a Foundation Model
A pre-trained large language or multimodal model available through Amazon Bedrock. to perform image analysis. The API accepts an image and returns a natural-language description generated by the model through an Inference Profile
A Bedrock configuration that specifies model parameters and routing for inference requests. .
Request Flow
Section titled “Request Flow”The image analysis request follows this path:
- Client sends a POST request to the
/analyzeendpoint via the Swagger UI or any HTTP client - The container receives the request and prepares a multimodal inference call
- The container invokes Bedrock using the Task Role credentials (scoped to foundation model and inference profile ARNs)
- Bedrock processes the image with the configured foundation model and returns a text response
- The container returns the model’s analysis as a JSON response to the client
Supported Image Input Methods
Section titled “Supported Image Input Methods”The API supports multiple ways to provide an image for analysis:
| Input Method | Description | Example Usage |
|---|---|---|
| Base64-encoded string | Image data encoded as a base64 string in the JSON request body | Include the image bytes directly in the |
| URL reference | A publicly accessible URL pointing to the image file | Pass the image URL in the |
Response Format
Section titled “Response Format”The API returns a JSON response containing the model’s analysis:
{ "description": "The image shows a golden retriever sitting on a grassy lawn...", "model_id": "anthropic.claude-3-sonnet-20240229-v1:0", "input_tokens": 1024, "output_tokens": 256}The response includes the generated description, the model identifier used for inference, and token usage metrics. Token counts help you estimate costs and monitor usage patterns.
Testing the API
Section titled “Testing the API”You can test the image analysis endpoint directly from the Swagger UI:
- Open the
web_ui_urloutput in your browser (or navigate to/docson your Application URL
The unique Express-provisioned HTTPS URL on *.ecs.<region>.on.aws used for all normal application traffic. ) - Expand the POST
/analyzeendpoint - Click Try it out
- Provide an image using one of the supported input methods (base64 string or URL)
- Click Execute to send the request
- Review the response body containing the model’s image description
Alternatively, use curl from the command line:
SERVICE_URL=$(terraform output -raw service_url)curl -X POST "${SERVICE_URL}/analyze" \ -H "Content-Type: application/json" \ -d '{"image_url": "https://placehold.co/600x400/png"}'