n8n
(short for "nodemation"). It is a node-based, open-source workflow and AI agent automation platform. It is a LCNC (Low-Code-No-Code) Platform, that lets you connect different apps, APIs, and AI models using a visual drag-and-drop editor.
Why
- Easy Configuration & Reusability: You can easily set up credentials once, import or export entire workflows as simple JSON files, and deploy the platform in minutes using a single Docker command.
- Cost-Effective Self-Hosting: You can host n8n on your own server for free, avoiding the steep per-task pricing limits of tools like Zapier or Make.
- Built-In AI Agent Capabilities: It provides native LangChain and AI nodes, making it easy to build autonomous AI agents that can use tools, remember context, and process data.
- Full Data Privacy: Running n8n on your own infrastructure ensures sensitive customer data and API keys never leave your private environment.
- Native MCP (Model Context Protocol) Support: n8n can act as both an MCP client and server, letting you easily connect external AI tools to your workflows or expose your n8n automations as tools for AI assistants like Claude.
- Code Meets No-Code: You can build quickly using a visual drag-and-drop canvas, while still having the freedom to write custom JavaScript or Python whenever you need complex logic.
- Universal API Connectivity: Beyond its hundreds of pre-built app integrations, the flexible HTTP Request node lets you connect to virtually any service with a REST or GraphQL API.
AWS Bedrock
Amazon Bedrock is a fully managed, serverless platform on Amazon Web Services (AWS) that allows you to build and scale generative AI applications using foundation models (FMs) from providers like Anthropic, Meta, Mistral, OpenAI and Amazon.
AWS Bedrock Inference Profile
Amazon Bedrock inference profiles are configuration and routing wrappers placed in front of foundation models to manage multi-region traffic (traffic spikes), track usage, and attribute costs.
For more details checkout
Create and manage inference profiles on Amazon Bedrock
Let's Connect the DOTS
Using docker/orbstack you can spin-up n8n self-hosted application in your laptop in minutes. You can use the following docker composer yaml, create a .env file to keep the environment values.
Example .env.example
# Generate with: openssl rand -hex 32 # WARNING: set this once and never rotate/lose it — it decrypts all stored credentials. N8N_ENCRYPTION_KEY= # Generate with: openssl rand -base64 32 N8N_USER_MANAGEMENT_JWT_SECRET= # Postgres credentials (not exposed to the host, only reachable from the n8n container) POSTGRES_USER=n8n POSTGRES_PASSWORD= POSTGRES_DB=n8n # n8n is bound to 127.0.0.1:5678 by default (see docker-compose.yml). # If you put a reverse proxy with TLS in front of it later, update these three # and switch N8N_PROTOCOL/N8N_SECURE_COOKIE to https/true. N8N_HOST=localhost N8N_PROTOCOL=http N8N_SECURE_COOKIE=false WEBHOOK_URL=http://localhost:5678/ TZ=Asia/Dhaka Example docker-compose.yml
services: postgres: image: postgres:16-alpine restart: unless-stopped # Note: the official postgres entrypoint needs root at first boot to chown the # data dir and drop privileges to the `postgres` user, so we don't cap_drop/lock # this one down the way n8n (fixed non-root user) is. environment: POSTGRES_USER: ${POSTGRES_USER} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} POSTGRES_DB: ${POSTGRES_DB} POSTGRES_INITDB_ARGS: "--auth-host=scram-sha-256 --auth-local=scram-sha-256" volumes: - postgres_data:/var/lib/postgresql/data # Not published to the host — only reachable from n8n on this compose network networks: - n8n_net healthcheck: test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"] interval: 10s timeout: 5s retries: 5 n8n: image: n8nio/n8n:1.123.64 # pin a specific version; check https://hub.docker.com/r/n8nio/n8n/tags before upgrading restart: unless-stopped user: "1000:1000" security_opt: - no-new-privileges:true cap_drop: - ALL depends_on: postgres: condition: service_healthy ports: - "127.0.0.1:5678:5678" # bind to localhost only; put behind your own reverse proxy for remote/HTTPS access environment: # --- Core secrets --- # Encrypts all stored credentials at rest. Generate once with: openssl rand -hex 32 # Never change this after workflows/credentials exist — you will lose access to them. N8N_ENCRYPTION_KEY: ${N8N_ENCRYPTION_KEY} # Signs user-management session/auth JWTs. Generate with: openssl rand -base64 32 N8N_USER_MANAGEMENT_JWT_SECRET: ${N8N_USER_MANAGEMENT_JWT_SECRET} # --- Database (Postgres, not the default SQLite) --- DB_TYPE: postgresdb DB_POSTGRESDB_HOST: postgres DB_POSTGRESDB_PORT: 5432 DB_POSTGRESDB_DATABASE: ${POSTGRES_DB} DB_POSTGRESDB_USER: ${POSTGRES_USER} DB_POSTGRESDB_PASSWORD: ${POSTGRES_PASSWORD} # --- Transport --- # Flip N8N_PROTOCOL to https and N8N_SECURE_COOKIE to true once you put n8n behind TLS. N8N_PROTOCOL: ${N8N_PROTOCOL} N8N_HOST: ${N8N_HOST} N8N_PORT: 5678 WEBHOOK_URL: ${WEBHOOK_URL} N8N_SECURE_COOKIE: ${N8N_SECURE_COOKIE} # --- Task isolation (runs Code/Function node execution in a separate sandboxed process) --- N8N_RUNNERS_ENABLED: "true" N8N_RUNNERS_MODE: internal # --- Hardening: block workflows from reading host env vars / arbitrary files --- N8N_BLOCK_ENV_ACCESS_IN_NODE: "true" N8N_RESTRICT_FILE_ACCESS_TO: /home/node/.n8n/files NODE_FUNCTION_ALLOW_BUILTIN: "" NODE_FUNCTION_ALLOW_EXTERNAL: "" # --- Reduce exposure surface / outbound telemetry --- N8N_DIAGNOSTICS_ENABLED: "false" N8N_VERSION_NOTIFICATIONS_ENABLED: "false" N8N_TEMPLATES_ENABLED: "false" N8N_PERSONALIZATION_ENABLED: "false" N8N_HIRING_BANNER_ENABLED: "false" # --- Execution data hygiene (don't retain credential-laden execution logs forever) --- EXECUTIONS_DATA_PRUNE: "true" EXECUTIONS_DATA_MAX_AGE: 336 # hours = 14 days EXECUTIONS_DATA_SAVE_ON_ERROR: all EXECUTIONS_DATA_SAVE_ON_SUCCESS: none EXECUTIONS_DATA_SAVE_MANUAL_EXECUTIONS: "true" GENERIC_TIMEZONE: ${TZ} N8N_LOG_LEVEL: info volumes: - n8n_data:/home/node/.n8n networks: - n8n_net healthcheck: test: ["CMD-SHELL", "wget -qO- http://127.0.0.1:5678/healthz || exit 1"] interval: 30s timeout: 5s retries: 5 networks: n8n_net: volumes: postgres_data: n8n_data: Add the building blocks in the workflow
Step 1: Chat Block
Once n8n starts, login to http://localhost:5678/ and create a workflow. Create a chat block in the workflow, you will get a view similar like below:
Step 2: AI Agent Block
Now add an AI Agent Block, here the block needs the 3 capabilities:
- Chat Model
- Memory
- Tools
Step 3: Chat Model
Add the AWS Bedrock Chat Model from the components list
and edit the Credential to connect with to the required:
- Region
- Access Key Id
- Secret Access Key
Once added do a connection test to confirm back.
You may be wondering how to get the Keys. Let me guide you though the AWS IAM to create a AWS IAM user with policy to bedrock:InvokeModel and create access keys.
The policy will look like below json:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "bedrock:InvokeModel", "bedrock:InvokeModelWithResponseStream", "bedrock:GetInferenceProfile" ], "Resource": [ "arn:aws:bedrock:<region>:<account-id>:inference-profile/global.anthropic.claude-haiku-4-5-<version>", "arn:aws:bedrock:*::foundation-model/anthropic.claude-haiku-4-5-<version>", "arn:aws:bedrock:::foundation-model/anthropic.claude-haiku-4-5-<version>" ] } ] } Step 4: Select the Bedrock Model
Here you need to select the model for the Agent from Bedrock list. 2 options:
- On Demand Models (Open Models are also available)
- Inference Profiles (Based on availability)
Here you can use Haiku 4.5 with Global Inference Profile
Step 5: Add Memory
As a chatting agent, it should follow the last 5-10 conversations as context while giving output. Hence, we need to add a memory to the Chat Agent. n8n out of the box provides a Simple Memory, just add the component and attach to the memory of the agent.
Step 6: Add Persona to the Agent
Here you need to set input the personality of the agent e.g. what is agent is for and do's and don't in a prompt.
You are a famous quote advisor, motivate the users. # Do's: - keep it short and precise - response in markdown # Don't: - avoid stereotyping - no explanation required Final run
We have connected all the dots and now it's time to run.
Here is where you can start a chat session with the newly created Agent.
Ask share a quote? and check out the response. You can visualize how the request flows between the chat input to the agent and gets a reply.













