πŸ“Œ Part 3: Creating an HTTP API in AWS API Gateway to Access Lambda (with Screenshot Guides)

1. Create an HTTP API via API Gateway

Purpose: The HTTP API allows you to expose the Lambda function via a public HTTP endpoint that you can call from external applications (e.g., Postman, Jupyter Notebook).

Steps:

πŸ”Ή Screenshot Tip:
πŸ”Ή Screenshot of the API Gateway landing page β†’ Create API


2. Configure API Integration with Lambda

Steps:

πŸ”Ή Screenshot Tip:
πŸ”Ή Screenshot the Add Integration screen showing your Lambda function selected


3. Configure Route

Steps:

πŸ”Ή Screenshot Tip:
πŸ”Ή Screenshot the Route configuration screen showing POST and /generate


4. Configure Stage

Steps:

πŸ”Ή Screenshot Tip:
πŸ”Ή Screenshot the Stage configuration screen with $default and Auto deploy enabled


5. Find Your Invoke URL

Steps:

https://your-api-id.execute-api.us-east-2.amazonaws.com
https://your-api-id.execute-api.us-east-2.amazonaws.com/generate

πŸ”Ή Screenshot Tip:
πŸ”Ή Screenshot of the API Invoke URL and the Routes tab showing /generate


6. (Optional) Test API Directly in AWS Console

{
  "prompt": "Write a poem about the ocean."
}

πŸ”Ή Screenshot Tip:
πŸ”Ή Screenshot of the API Gateway testing console showing request/response


7. Example API Request from External Client (Python)

You can now interact with your model remotely using a simple Python script.

import requests

# Replace with your actual invoke URL
url = "https://your-api-id.execute-api.us-east-2.amazonaws.com/generate"

data = {"prompt": "Write an article about deploying LLM models to AWS services"}

response = requests.post(url, json=data)

print(response.json())

πŸ”Ή Screenshot Tip:
πŸ”Ή Optional: Screenshot of API call from a Jupyter Notebook or terminal


πŸ”Ή Summary Checklist:


πŸ”Ή Important Notes:


πŸ”Ή Next Step: You are now ready to send HTTP requests to your SageMaker-powered LLM model through API Gateway!