We will securely store and encrypt the access key (API Key) of the External AI using the AWS Secrets Manager service. This secret key will be encrypted with the project’s KMS Key, and only the AI Proxy Lambda function will have permission to retrieve its value.
Before creating the AWS secret, you need an API key from the LLM provider. In this workshop, the AI Proxy Lambda code calls the OpenAI API at /v1/chat/completions and uses gpt-4o as the default model.
docuflow-ai-workshop.docuflow-dev-ai-proxy.gpt-4o, record the model name so you can configure the OPENAI_MODEL environment variable in the AI Proxy Lambda step.Do not put the API key in the frontend, GitHub, public .env files, or screenshots. In this workshop, the API key is pasted only into AWS Secrets Manager with the key name api_key.
Create a new Secret:


Configure Key/value pairs:
api_key (lowercase, no spaces, standard for the project code).alias/docuflow-dev-main-key (Do not use the default aws/secretsmanager key to ensure maximum information security standards).
Set secret name and description:
docuflow-dev-external-ai-api-key.
Stores API Key for External AI normalization integration used exclusively by AI Proxy Lambda.


Record the Secret ARN:
arn:aws:secretsmanager:ap-southeast-1:<AWS_ACCOUNT_ID>:secret:docuflow-dev-external-ai-api-key-XXXXXX).Grant exclusive permissions solely to AI Proxy Lambda (Security Checkpoint):
To correctly configure your Lambda to read this secret, configure the IAM Policy as follows:
docuflow-dev-ai-secret-read-policy ➔ Select the JSON tab ➔ Edit.* at the end as below):
