APIs on AWS Archives - AWS Security Architect https://awssecurityarchitect.com/category/apis-on-aws/ Experienced AWS, GCP and Azure Security Architect Thu, 20 Aug 2026 13:40:57 +0000 en-US hourly 1 https://wordpress.org/?v=7.1 214477604 https://awssecurityarchitect.com/aws-machine-learning/529/ https://awssecurityarchitect.com/aws-machine-learning/529/#respond Thu, 20 Aug 2026 13:40:57 +0000 https://awssecurityarchitect.com/?p=529 Building an AI-Powered Fraud Detection System on AWS Modern fraud detection should no longer be viewed as a single machine-learning model that returns a fraud score. A production fraud platform […]

The post appeared first on AWS Security Architect.

]]>
Building an AI-Powered Fraud Detection System on AWS
Modern fraud detection should no longer be viewed as a single machine-learning model that returns a fraud score.
A production fraud platform can combine real-time event processing, behavioral features, machine learning,
deterministic controls, anomaly detection and agentic AI
.

On AWS, such a platform can be built using services including:

  • Amazon API Gateway
  • Amazon Kinesis Data Streams
  • AWS Lambda
  • Amazon S3
  • Amazon SageMaker AI
  • SageMaker Feature Store
  • Amazon DynamoDB
  • Amazon Aurora
  • Amazon Athena
  • Amazon Bedrock
  • Amazon Bedrock AgentCore
  • Bedrock Knowledge Bases

The central architectural principle is simple:

SageMaker predicts.

Rules enforce.

Bedrock investigates and explains.

The large language model should therefore not become the system directly authorizing or rejecting financial transactions.
Instead, machine learning and deterministic policies remain in the transaction decision path while generative AI assists
fraud analysts with investigation, correlation and explanation.

1. High-Level AWS Fraud Detection Architecture

                  TRANSACTION SOURCES
                         |
                         v
                Amazon API Gateway
                         |
                         v
               Amazon Kinesis Streams
                         |
             +-----------+-----------+
             |                       |
             v                       v
         AWS Lambda                Amazon S3
             |                     Data Lake
             v
     SageMaker Feature Store
             |
             v
       SageMaker Model
             |
             v
        Fraud Score
             |
      +------+------+ 
      |      |      |
      v      v      v
   APPROVE REVIEW  HOLD
             |      |
             +---+--+
                 |
                 v
          Bedrock AgentCore
                 |
                 v
        AI Fraud Investigator
                 |
       +---------+----------+
       |         |          |
       v         v          v
   Customer   Transaction   Fraud
    History     History    Knowledge
       |         |          |
       +---------+----------+
                 |
                 v
        Investigation Report
                 |
                 v
            Fraud Analyst

2. Real-Time Transaction Ingestion

Transactions can originate from many systems:

  • Credit-card payments
  • ACH payments
  • Wire transfers
  • Mobile banking
  • Online banking
  • Account-profile changes
  • Login events
  • Device telemetry
  • IP-address and geolocation telemetry

Amazon API Gateway can expose transaction APIs, while Amazon Kinesis Data Streams provides a scalable mechanism
for streaming the events through the fraud platform.

AWS Lambda can perform lightweight enrichment before the transaction is evaluated by the machine-learning model.

3. Feature Engineering: Where Much of the Fraud Intelligence Lives

A fraud model should rarely evaluate a transaction using the transaction amount alone.
The important information often comes from how the transaction differs from the customer’s historical behavior.

Consider a transaction for $7,500 when the customer’s typical transaction is approximately $310.

Current transaction = $7,500

Average transaction = $310

7,500 / 310 = 24.2

The transaction is therefore more than 24 times the customer’s normal transaction size.
That derived value may be substantially more useful to the model than the original transaction amount.

Useful fraud features might include:

amount_deviation

transaction_velocity_10m

transaction_velocity_24h

distance_from_last_transaction

new_device

new_beneficiary

ip_country_changed

failed_logins_24h

password_changed_recently

account_age

merchant_fraud_rate

historical_average_spend

device_risk_score

These features can be stored and managed through Amazon SageMaker Feature Store.

4. The SageMaker Fraud Model

For many financial-fraud problems, an excellent place to begin is a supervised model such as
XGBoost.

Fraud data is usually highly structured and tabular, making boosted decision-tree models particularly appropriate.
More sophisticated neural architectures can be introduced later if the problem and data justify the additional complexity.

A transaction presented to the model might contain features similar to:

fraud_features = {
    "amount": 7500,
    "account_age_days": 840,
    "transactions_last_10_min": 8,
    "distance_from_last_location": 1800,
    "new_device": 1,
    "new_beneficiary": 1,
    "merchant_risk_score": 0.74,
    "average_transaction": 310
}

The SageMaker model could return:

{
  "fraud_probability": 0.932,
  "risk": "HIGH"
}

5. Combine Classification with Anomaly Detection

Fraud systems do not necessarily need to rely on a single model.
A supervised fraud classifier can be combined with an anomaly-detection model.

                 Transaction
                      |
          +-----------+-----------+
          |                       |
          v                       v
   Classification Model      Anomaly Model
          |                       |
       Fraud .91              Anomaly .84
          |                       |
          +-----------+-----------+
                      |
                      v
               Combined Risk
                      |
                      v
                     .93

The first model detects patterns learned from previously identified fraud.
The anomaly model helps identify behavior that is simply unusual, including patterns the supervised model may never
have encountered before.

6. Keep the Real-Time Decision Engine Deterministic

The high-speed transaction path should remain relatively simple and deterministic.

Transaction
    |
    v
API Gateway
    |
    v
Lambda
    |
    v
Retrieve Features
    |
    v
SageMaker Endpoint
    |
    v
Fraud Probability
    |
    v
Decision Engine

A simple policy could look like this:

if fraud_score >= 0.90:
    decision = "HOLD"

elif fraud_score >= 0.70:
    decision = "MANUAL_REVIEW"

else:
    decision = "APPROVE"

A production decision engine could combine several independent signals:

Machine-Learning Score
        +
Business Rules
        +
Anomaly Score
        +
Device Risk
        +
Account Risk
        |
        v
 Final Risk Score

7. Add an AI Fraud Investigation Agent

Once a transaction crosses a fraud threshold, the case can be routed to an agentic AI investigation layer built
with Amazon Bedrock and Amazon Bedrock AgentCore.

Suppose the fraud engine reports:

Transaction: TX-88121
Fraud Probability: 93.2%
Risk Level: HIGH

The fraud investigation agent can collect evidence from multiple systems.

Fraud Investigation Agent
          |
          +-- Retrieve transaction details
          |
          +-- Retrieve transaction history
          |
          +-- Retrieve customer behavior
          |
          +-- Retrieve device history
          |
          +-- Retrieve IP/geolocation history
          |
          +-- Retrieve model explanation
          |
          +-- Search similar fraud cases
          |
          +-- Retrieve relevant fraud policies

The agent can then convert technical signals into a concise investigation report.

FRAUD INVESTIGATION REPORT

Risk: HIGH
Fraud Probability: 93.2%

Primary Indicators

1. Transaction amount is 24x the customer's normal transaction.

2. The device has never previously accessed the account.

3. The transaction originated approximately 1,800 miles
   from the customer's previous transaction location.

4. A new beneficiary was created 11 minutes before
   the transfer.

5. Eight transactions were attempted during the
   previous ten minutes.

6. Similar patterns exist in previously confirmed
   fraud cases.

Recommended Action:

HOLD TRANSACTION

Require step-up authentication and analyst review.

8. Give the Agent Tools, Not Direct Database Access

One of the most important AI-security controls is preventing the LLM from having unrestricted database access.

The agent should instead receive narrowly scoped tools such as:

get_transaction()

get_customer_profile()

get_transaction_history()

get_device_history()

get_ip_history()

get_fraud_score()

retrieve_similar_cases()

retrieve_fraud_policy()

create_investigation()

These tools can invoke Lambda functions or controlled services that enforce authorization before accessing
DynamoDB, Aurora, Athena, SageMaker or internal APIs.

The preferred pattern is:

LLM
 |
 v
Agent Tool
 |
 v
Authorization
 |
 v
Retriever / Data Access Layer
 |
 +-- RBAC / ACL enforcement
 |
 +-- Sensitive-data filtering
 |
 +-- Query validation
 |
 +-- Audit logging
 |
 v
Enterprise Data

This is effectively the traditional Data Access Layer pattern applied to enterprise AI.

9. Build a Fraud Knowledge Base with RAG

Fraud investigators require more than transactional data.
They also need institutional knowledge.

A Bedrock Knowledge Base can contain information such as:

  • Fraud policies
  • Historical fraud investigations
  • Known attack patterns
  • Investigation playbooks
  • AML procedures
  • Device-risk guidance
  • Regulatory guidance
  • Internal security procedures
             Fraud Knowledge Base
                     |
       +-------------+-------------+
       |             |             |
       v             v             v
 Fraud Policies   Past Cases   Regulations
       |             |             |
       +-------------+-------------+
                     |
                     v
                Bedrock RAG
                     |
                     v
            Investigation Agent

Retrieval-Augmented Generation, or RAG, allows the model to reason against enterprise information instead of relying
entirely on the information embedded in the foundation model.

10. Explainable Fraud Detection

A fraud analyst needs more than a score.

Instead of returning only:

Fraud Probability = 93%

the system should capture the factors that contributed to that probability.

Risk Feature Contribution
New device +21%
New beneficiary +18%
Transaction velocity +17%
Geographic anomaly +15%
Transaction amount anomaly +13%
IP risk +6%

The generative AI layer can then translate these model signals into an explanation understandable by a fraud analyst,
customer-service representative or investigator.

11. The Fraud Analyst Interface

The analyst should receive a consolidated view of the case rather than searching across numerous systems.

--------------------------------------------------

            FRAUD INVESTIGATION

Transaction: TX-88121

Fraud Score                  93%
Risk                         HIGH
Recommended Action           HOLD

--------------------------------------------------

Top Risk Indicators

New Device                   HIGH
Geo Anomaly                  HIGH
Transaction Velocity         HIGH
New Beneficiary              HIGH
Amount Anomaly               MEDIUM

--------------------------------------------------

AI Investigation

The transaction differs significantly from the
customer's historical behavior...

[View Evidence]

--------------------------------------------------

     APPROVE      HOLD      CONFIRM FRAUD

--------------------------------------------------

12. Create a Continuous Fraud-Learning Loop

The fraud analyst’s decision should not disappear after the investigation is complete.
It represents extremely useful labeled training data.

AI Prediction
     |
     v
Analyst Decision
     |
     v
Confirmed Fraud
or
Legitimate Transaction
     |
     v
Training Dataset
     |
     v
Model Evaluation
     |
     v
SageMaker Retraining

Over time, analyst decisions create a feedback mechanism through which the fraud model can learn from new attack
techniques and changing customer behavior.

13. The Complete AWS Architecture

                   BANKING / PAYMENT SYSTEMS
                             |
                             v
                    Amazon API Gateway
                             |
                             v
                   Amazon Kinesis Streams
                             |
               +-------------+-------------+
               |                           |
               v                           v
           AWS Lambda                    Amazon S3
               |                         Data Lake
               v                            |
     SageMaker Feature Store                |
               |                            |
               v                            v
        SageMaker Endpoint             Glue / Athena
               |
               v
         Fraud Probability
               |
               v
         Decision Engine
               |
       +-------+--------+
       |       |        |
       v       v        v
    APPROVE  REVIEW    HOLD
               |        |
               +---+----+
                   |
                   v
          Amazon Bedrock AgentCore
                   |
                   v
           Fraud Investigator
                   |
       +-----------+------------+
       |           |            |
       v           v            v
   Agent Tools   Knowledge    SageMaker
                   Base       Explanation
       |
  +----+-----+------+
  |          |      |
  v          v      v
DynamoDB   Aurora  Athena
                   |
                   v
          Investigation Report
                   |
                   v
             Fraud Analyst
                   |
                   v
           Analyst Decision
                   |
                   v
             Training Data
                   |
                   v
         SageMaker Retraining

14. Three Layers of Fraud Intelligence

Perhaps the most useful way to understand the architecture is as three separate intelligence layers.

Layer 1: Deterministic Rules

New Beneficiary
+
Large Transfer
+
Recently Changed Password
=
Require Additional Verification

Rules provide predictable security controls for conditions the institution already understands.

Layer 2: Machine Learning

Customer Behavior
+
Transaction History
+
Device Signals
+
Velocity
+
Geography
       |
       v
SageMaker
       |
       v
Fraud Probability = 93%

Machine learning identifies combinations of signals that are too complex to represent through manually maintained rules.

Layer 3: Agentic AI

Fraud Alert
    |
    v
Bedrock Agent
    |
    +-- Why is this suspicious?
    |
    +-- What evidence supports the alert?
    |
    +-- Have we seen similar cases?
    |
    +-- What policy applies?
    |
    +-- What should the analyst investigate?

This layer is not intended to replace the fraud model.
Its role is to investigate, correlate, retrieve, summarize and explain.

15. Why the LLM Should Not Directly Approve Financial Transactions

It may be tempting to place a generative AI model directly in the transaction-decision path.
That would usually be a poor architecture.

Generative models are probabilistic systems.
Financial authorization controls frequently require deterministic behavior, clear thresholds, explainability,
auditability and repeatability.

A safer separation of responsibilities is:

Technology Primary Responsibility
Business Rules Enforce known fraud and financial controls
Amazon SageMaker Predict fraud probability and detect anomalies
Amazon Bedrock Reason over evidence and enterprise knowledge
Bedrock AgentCore Orchestrate investigation workflows and tools
Fraud Analyst Make high-risk investigation decisions requiring human judgment

16. Moving Toward a Multi-Agent Fraud Platform

The architecture can eventually evolve beyond a single fraud agent.
A financial institution could create specialized agents responsible for different categories of fraud.

                 FRAUD SUPERVISOR AGENT
                          |
          +---------------+---------------+
          |               |               |
          v               v               v
    Transaction       Account        Identity /
    Fraud Agent       Behavior       Takeover Agent
                      Agent
          |               |               |
          +---------------+---------------+
                          |
                          v
                Correlated Risk View
                          |
                          v
                 Fraud Investigation

For example:

  • Transaction Fraud Agent: Investigates unusual payments, transfers and merchant activity.
  • Account Behavior Agent: Looks for changes in transaction velocity, beneficiaries and account behavior.
  • Identity/Account-Takeover Agent: Investigates device, login, authentication and geolocation anomalies.
  • Fraud Supervisor Agent: Correlates findings and produces a unified case for the investigator.

This transforms the architecture from a traditional fraud-scoring system into an
agentic fraud operations platform.

Conclusion

The next generation of fraud detection is unlikely to be built around a single AI model.
Instead, it will combine multiple forms of intelligence.

Rules
  +
Machine Learning
  +
Anomaly Detection
  +
Enterprise Data
  +
RAG
  +
Agentic AI
  +
Human Investigation

Amazon SageMaker can determine whether a transaction resembles fraudulent behavior.
Traditional rules can enforce known financial controls.
Amazon Bedrock and AgentCore can investigate why the transaction was flagged, correlate evidence,
retrieve relevant institutional knowledge and explain the case to an analyst.

The architectural principle remains:

SageMaker predicts. Rules enforce. Bedrock investigates.

That separation creates a system that can take advantage of modern generative and agentic AI without placing
a probabilistic language model directly in control of financial authorization decisions.

 

The post appeared first on AWS Security Architect.

]]>
https://awssecurityarchitect.com/aws-machine-learning/529/feed/ 0 529
AWS API Gateway vs AWS WAF: Features, Differences and Architecture https://awssecurityarchitect.com/apis-on-aws/aws-api-gateway-vs-aws-waf-features-differences-and-architecture/ https://awssecurityarchitect.com/apis-on-aws/aws-api-gateway-vs-aws-waf-features-differences-and-architecture/#respond Mon, 17 Aug 2026 17:54:45 +0000 https://awssecurityarchitect.com/?p=526 AWS API Gateway vs AWS WAF: Features, Differences and Architecture AWS API Gateway vs. AWS WAF: What’s the Difference? AWS API Gateway and AWS WAF are both commonly found at […]

The post AWS API Gateway vs AWS WAF: Features, Differences and Architecture appeared first on AWS Security Architect.

]]>
AWS API Gateway vs AWS WAF: Features, Differences and Architecture

AWS API Gateway vs. AWS WAF: What’s the Difference?

AWS API Gateway and AWS WAF are both commonly found at the front of modern AWS applications. Because both can control incoming HTTP traffic—and both provide some form of rate limiting—they are sometimes confused with each other.

However, they solve fundamentally different problems:

AWS API Gateway manages APIs. AWS WAF protects applications and APIs from malicious or unwanted HTTP traffic.

In a well-designed architecture, they are often used together rather than as alternatives.


What Is AWS API Gateway?

Amazon API Gateway is a managed service for creating, publishing, securing, monitoring, and operating APIs.

It acts as the front door to your application’s backend services.

A simple serverless architecture might look like this:

Client
   │
   │ HTTPS
   ▼
AWS API Gateway
   │
   ├── Authenticate
   ├── Authorize
   ├── Validate API request
   ├── Apply throttling
   ├── Log request
   └── Route request
   │
   ▼
AWS Lambda
   │
   ▼
DynamoDB

API Gateway can expose APIs backed by services such as:

  • AWS Lambda
  • HTTP services
  • Applications running on EC2
  • Containerized applications
  • Other AWS services

API Gateway supports REST APIs, HTTP APIs, and WebSocket APIs.


Major AWS API Gateway Features

Feature API Gateway
REST APIs ✅
HTTP APIs ✅
WebSocket APIs ✅
Backend routing ✅
Lambda integration ✅
IAM authorization ✅
Cognito authorization ✅
Lambda authorizers ✅
JWT authorization ✅, depending on API type
API keys ✅
Usage plans ✅, REST APIs
Client quotas ✅
Request throttling ✅
Request/response transformation ✅
API stages ✅
Canary deployments ✅
Custom domains ✅
CloudWatch monitoring ✅
X-Ray integration ✅
Response caching ✅, REST APIs

The important point is that API Gateway understands the concept of an API consumer and API operation.

For example:

Customer A
    │
 API Key
    │
    ▼
API Gateway
    │
    ├── Authenticate
    ├── Authorize
    ├── Check quota
    ├── Check throttle
    └── POST /orders
           │
           ▼
        Lambda

API Gateway can therefore enforce rules associated with how clients consume an API.


What Is AWS WAF?

AWS WAF (Web Application Firewall) is a Layer-7 security service designed to inspect HTTP/S traffic and determine whether requests should be allowed, blocked, counted, challenged, or presented with CAPTCHA.

Its primary concern is not:

“Which backend should receive this API call?”

Instead, WAF is asking:

“Should I allow this HTTP request through at all?”

For example:

Internet
   │
   ▼
AWS WAF
   │
   ├── Source IP?
   ├── Country?
   ├── SQL injection?
   ├── XSS?
   ├── Malicious bot?
   ├── Suspicious request?
   └── Excessive traffic?
   │
   ▼
Application / API

Major AWS WAF Features

AWS WAF provides capabilities such as:

Feature AWS WAF
IP blocking ✅
IP allowlists ✅
Geo-blocking ✅
Header inspection ✅
URI inspection ✅
Query-string inspection ✅
Request-body inspection ✅
Regex/string matching ✅
SQL injection protection ✅
Cross-site scripting protection ✅
AWS Managed Rules ✅
Custom security rules ✅
Rate-based rules ✅
Bot protection ✅
CAPTCHA ✅
Browser challenge ✅
Request monitoring/counting ✅

For example, an organization could create WAF rules that say:

IF request originates from blocked country
    → BLOCK

IF request contains SQL injection pattern
    → BLOCK

IF request originates from known malicious IP
    → BLOCK

IF suspicious client exceeds rate threshold
    → BLOCK / CHALLENGE

This is fundamentally different from API management.


AWS API Gateway vs. AWS WAF

The easiest way to understand the difference is to compare their responsibilities.

Capability API Gateway AWS WAF
Expose an API ✅ ❌
Route API requests ✅ ❌
REST API management ✅ ❌
Authentication ✅ ❌
Authorization ✅ ❌
API keys ✅ ❌
Usage plans ✅ ❌
Client quotas ✅ ❌
API throttling ✅ ❌
Security rate-based rules ❌ ✅
IP filtering Limited via policies ✅
Geo-blocking ❌ ✅
SQL injection protection ❌ ✅
XSS protection ❌ ✅
Bot protection ❌ ✅
CAPTCHA/challenge ❌ ✅
Managed attack rules ❌ ✅
Backend integration ✅ ❌
Lambda integration ✅ ❌
Request transformation ✅ ❌
API lifecycle/deployment ✅ ❌

There is, however, one area where the distinction can become confusing: rate limiting.


API Gateway Throttling vs. WAF Rate Limiting

Both services can limit requests, but they do so for different reasons.

API Gateway Throttling

API Gateway throttling is primarily concerned with API consumption and backend capacity.

For example:

Customer A
    │
    │ API Key
    │
    │ 100 requests/sec
    ▼
API Gateway

The business requirement might be:

Customer A should be permitted to consume approximately 100 requests per second.

You may also have different consumption limits for different customers or API products.

Basic Customer
      │
      └── Lower quota

Premium Customer
      │
      └── Higher quota

Enterprise Customer
      │
      └── Highest quota

This is API consumption management.


WAF Rate Limiting

WAF rate-based rules are primarily a security control.

Suppose one IP suddenly generates thousands of requests:

Suspicious Client
      │
      │
      │ 10,000 requests
      │
      ▼
    AWS WAF
      │
      ├── Rate threshold exceeded
      │
      └── BLOCK / CHALLENGE

The question WAF is answering isn’t:

“What API subscription does this customer have?”

Instead, it is:

“Does this traffic pattern represent something I should block or challenge?”

This makes WAF rate-based rules useful for mitigating abusive traffic, bots, scraping, credential attacks, and certain application-layer denial-of-service patterns.


A Simple Way to Remember the Difference

Think about the questions each service is trying to answer.

AWS WAF asks:

Is this request safe and acceptable?

It looks at things such as:

  • Source IP
  • Geography
  • Request patterns
  • SQL injection
  • XSS
  • Bots
  • Suspicious request rates

API Gateway asks:

Who is calling my API,
what are they allowed to call,
how much may they consume,
and where should the request go?

It handles things such as:

  • Authentication
  • Authorization
  • API keys
  • Usage plans
  • Quotas
  • Throttling
  • API routing
  • Backend integration

API Gateway and WAF Are Usually Used Together

For a public-facing API, a stronger architecture uses both services.

                     Internet
                        │
                        ▼
                ┌───────────────┐
                │    AWS WAF    │
                │               │
                │ SQLi / XSS    │
                │ IP filtering  │
                │ Geo blocking  │
                │ Bot control   │
                │ Rate rules    │
                └───────┬───────┘
                        │
                        ▼
               ┌─────────────────┐
               │   API Gateway   │
               │                 │
               │ Authentication  │
               │ Authorization   │
               │ API Keys        │
               │ Usage Plans     │
               │ Throttling      │
               │ Routing         │
               └────────┬────────┘
                        │
                        ▼
                     Lambda
                        │
                        ▼
                    DynamoDB

This creates multiple layers of protection.


What Happens When a Request Arrives?

Conceptually, the security flow becomes:

Incoming Request
       │
       ▼
    AWS WAF
       │
       ├── Is source IP allowed?
       ├── Is geography allowed?
       ├── SQL injection?
       ├── XSS?
       ├── Malicious bot?
       └── Excessive traffic?
       │
       ▼
  API Gateway
       │
       ├── Who are you?
       ├── Are you authenticated?
       ├── Are you authorized?
       ├── Which API are you calling?
       ├── Are you within your quota?
       └── Where should this request go?
       │
       ▼
    Backend

This is a good example of defense in depth.

WAF performs application-layer traffic filtering before the request reaches the API-management and application layers.

API Gateway then applies API-specific controls before forwarding the request to the backend.


What About Authentication?

Another important distinction is that WAF is not an identity system.

You should not think of WAF as replacing IAM, Cognito, JWT validation, or an API authorizer.

Authentication might instead look like:

Internet
   │
   ▼
AWS WAF
   │
   │ Security filtering
   ▼
API Gateway
   │
   ├── Cognito
   ├── IAM
   ├── JWT
   └── Lambda Authorizer
   │
   ▼
Application

This separates three important security responsibilities:

WAF
 │
 └── Is the HTTP request acceptable?

API Gateway
 │
 └── Is the API request valid and permitted?

Application
 │
 └── Is the requested business operation allowed?

That separation becomes increasingly important in enterprise architectures.


Where Does CloudFront Fit?

For internet-facing applications, another common architecture introduces Amazon CloudFront:

Internet
   │
   ▼
CloudFront
   │
   ▼
AWS WAF
   │
   ▼
API Gateway
   │
   ▼
Lambda
   │
   ▼
DynamoDB

CloudFront provides global edge delivery and caching, while WAF provides Layer-7 filtering and API Gateway provides API management.

The responsibilities remain distinct:

CloudFront
     │
     └── Global delivery / edge

AWS WAF
     │
     └── Application security

API Gateway
     │
     └── API management

Lambda
     │
     └── Application logic

DynamoDB
     │
     └── Data

AWS vs. GCP Equivalent Services

For architects working across AWS and Google Cloud, the high-level mapping is:

AWS Google Cloud Purpose
AWS WAF Cloud Armor Layer-7 application protection
Amazon API Gateway Google Cloud API Gateway Managed API gateway
Amazon API Gateway / broader API-management patterns Apigee Enterprise API management
AWS Lambda Cloud Run / Cloud Functions Serverless compute
CloudWatch Cloud Logging / Cloud Monitoring Observability

The equivalent GCP architecture might therefore look like:

AWS                           GCP

Internet                     Internet
   │                            │
   ▼                            ▼
AWS WAF                    Cloud Armor
   │                            │
   ▼                            ▼
API Gateway            API Gateway / Apigee
   │                            │
   ▼                            ▼
Lambda                Cloud Run / Functions

Which One Should You Use?

The answer is usually not API Gateway or WAF.

If you need to expose and manage APIs, use API Gateway.

If you need to protect HTTP applications and APIs against malicious or unwanted traffic, use AWS WAF.

For important public-facing APIs, consider using both:

Internet
   │
   ▼
WAF
   │
   │ Security boundary
   ▼
API Gateway
   │
   │ API management boundary
   ▼
Application
   │
   │ Business authorization boundary
   ▼
Data

Each layer solves a different problem.


Final Takeaway

The simplest distinction is:

AWS WAF determines whether an HTTP request should be allowed to reach your application.

AWS API Gateway determines how an API request should be authenticated, authorized, controlled, and routed to a backend.

API Gateway is an API management service.

AWS WAF is an application security service.

Used together, they provide a much stronger architecture than either service provides by itself.

The post AWS API Gateway vs AWS WAF: Features, Differences and Architecture appeared first on AWS Security Architect.

]]>
https://awssecurityarchitect.com/apis-on-aws/aws-api-gateway-vs-aws-waf-features-differences-and-architecture/feed/ 0 526
How to tell whether an endpoint is public facing? https://awssecurityarchitect.com/apis-on-aws/how-to-tell-whether-an-endpoint-is-public-facing/ https://awssecurityarchitect.com/apis-on-aws/how-to-tell-whether-an-endpoint-is-public-facing/#respond Tue, 25 Nov 2025 16:34:04 +0000 https://awssecurityarchitect.com/?p=498   Interpreting a JSON 404 Response Context: you received a JSON response with status: 404 detail: "no static resource /api/v2/users/myapp" Quick answer This does not prove the API endpoint is […]

The post How to tell whether an endpoint is public facing? appeared first on AWS Security Architect.

]]>
 

Interpreting a JSON 404 Response

Context: you received a JSON response with

status: 404
detail: "no static resource /api/v2/users/myapp"

Quick answer

This does not prove the API endpoint is publicly accessible. It only shows your request reached a web server or proxy which could not find a matching static resource or route.

What this response does indicate

  • The request reached a server or reverse proxy. The phrase “no static resource” is commonly emitted by web servers or frameworks when a path is not mapped to a file or route.
  • The server attempted to treat the path as a static/file request and didn’t find a corresponding file or route.
  • You hit an upstream layer (NGINX, CDN, API Gateway, Spring Boot static handler, Express static middleware, etc.) that answered on behalf of the infrastructure.

What this response does not mean

  • It does not mean the endpoint is public. Protected or internal endpoints often return 404 (instead of 401/403) to avoid revealing existence.
  • It does not prove you reached the backend API handler. You may be stopped at a routing/gateway/static file layer before auth or controller logic runs.

Likely causes

  • Wrong HTTP method (e.g., using GET when the API expects POST).
  • Missing URL prefix, incorrect path, or path is only accessible behind authentication or a different route.
  • Gateway/router misconfiguration or the backend service is not registered or not healthy.
  • Security configuration that masks endpoints (returns 404 for unauthorized callers).

How to investigate further (practical checks)

  1. Try an OPTIONS request (CORS preflight):
    OPTIONS /api/v2/users/myapp

    If public/web-facing, OPTIONS often returns 200/204 and CORS headers. A 404 for OPTIONS suggests the route isn’t exposed at the public layer.

  2. Compare several paths:If both a known-valid endpoint and random paths return the same no static resource text, the gateway is likely returning a generic fallback instead of routing to APIs.
  3. Inspect response headers:
    Access-Control-Allow-Origin: *
    Server: nginx
    x-envoy-response-flags: ...
    

    Headers like Access-Control-Allow-Origin or absence/presence of proxy headers (x-envoy, x-amzn-) give clues about whether you’re hitting a public API gateway or internal proxy.

  4. Validate method and payload: Ensure you used the correct HTTP verb, required headers (Authorization, Content-Type), and correct URL encoding.
  5. Check authentication behavior: Try an authenticated request (if permitted). If the server then returns a different error (401/403/200), the earlier 404 was likely a security masking behavior.
  6. Test another known endpoint on the same domain: If other documented endpoints respond normally, the issue is likely the specific path. If none respond, routing or gateway is the problem.

Example diagnostic flow

// 1. Preflight
OPTIONS /api/v2/users/myapp

// 2. Simple GET (no auth)
GET /api/v2/users/myapp
→ 404 "no static resource /api/v2/users/myapp"

// 3. GET with Authorization (if you have creds)
GET /api/v2/users/myapp
Authorization: Bearer 
→ 200 / 401 / 403 / other

// 4. Try a different known endpoint
GET /api/v2/health
→ 200  (gateway routing ok) OR 404 (gateway not routing)
Bottom line: The message indicates you reached a server layer that did not find a matching static resource or route — but it does not prove the API is public. Additional checks (OPTIONS, headers, authenticated requests, and testing known endpoints) will help determine whether the route is exposed or is being intentionally hidden behind authentication/routing logic.
If you want, paste the full HTTP response headers (no secrets) and I’ll analyze them and suggest next steps.

The post How to tell whether an endpoint is public facing? appeared first on AWS Security Architect.

]]>
https://awssecurityarchitect.com/apis-on-aws/how-to-tell-whether-an-endpoint-is-public-facing/feed/ 0 498