Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
freem
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Openai/694ab010-3e7c-8000-b0e8-b98c22b7a063
(section)
Add languages
Page
Discussion
English
Read
Edit
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== ## === In ECR: # Create repository ml-chatbot-ui # Create repository ml-chatbot-api You will build/push both from your EC2 builder instance as before (using ECR “View push commands” in console and pasting into EC2 shell). ==== ### ==== * Container port: 8000 * Secrets: OPENAI_API_KEY from Secrets Manager * CloudWatch logs enabled ===== - Container port: 8501 ===== * No OpenAI key needed (UI shouldn’t hold secrets) * It only needs an environment variable like: - API_BASE_URL = https://<your-api-gateway>/prod ==== You can do either: ==== '' One ALB with two target groups + path routing - / → Streamlit target group (8501) - /api/'' → FastAPI target group (8000) * Or two ALBs (cleaner separation, more cost) Given you explicitly want API Gateway, the most common is: * ALB #1 for Streamlit (public) * ALB #2 for FastAPI (public or internal depending on design), but API Gateway will call it For simplicity and clarity: * Use one ALB with two target groups: - TG-UI (8501) - TG-API (8000) Then configure API Gateway integration to route to: '' http://ALB_DNS_NAME/api/... (ALB listener rule forwards /api/'' to FastAPI TG) ==== In API Gateway (HTTP API): ==== # Integration: HTTP → http://ALB_DNS_NAME # Routes: - ANY /api/{proxy+} → that integration # Stage: prod Now the API URL becomes: https://...execute-api.../prod/api/... ==== Your Streamlit code should call: ==== API_BASE_URL = https://...execute-api.../prod And when user chats: * Streamlit sends request to POST {API_BASE_URL}/api/chat * FastAPI returns response JSON * Streamlit renders it This keeps: * Secrets in backend only * API gateway where it belongs * UI stable
Summary:
Please note that all contributions to freem are considered to be released under the Creative Commons Attribution-ShareAlike 4.0 (see
Freem:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)