Generative AI in Industrial Data with AWS Bedrock

Amazeng Technical Team
5 min read
AWS BedrockGenerative AIClaudeLlamaIndustrial AIFoundation ModelsLLMRAG

Amazon Bedrock is a fully managed AWS service that gives you access, through a single API and without managing servers, to foundation models from providers such as Anthropic (Claude), Meta (Llama), Mistral AI and Amazon. Its strongest role in industrial data is not to replace numerical analysis, but to explain deviations found by statistical methods, turn an operator's plain-language question into a query, write maintenance reports and answer from operating manuals. In this article we look at these scenarios in the context of our Cloud & IoT Data Collection Solutions.

What does a large language model do well with sensor data, and what not?

Language models are not reliable at reading a series of thousands of numbers and spotting the outlier; z-scores, moving averages or purpose-trained anomaly models are both more accurate and far cheaper for that job. The right division of labour is:

TaskBest toolBedrock's role
Outlier / anomaly detectionStatistics, ML model (edge or cloud)Explaining the detected anomaly in context
Turning an operator question into a queryLLM (text-to-SQL)Direct
Weekly maintenance reportLLMWriting report text from summary data
Answers from manuals and proceduresRAG (Knowledge Bases)Direct
Control decisions (open/close a valve)PLC / deterministic logicNot recommended

How do Bedrock, the OpenAI API and local models compare?

FeatureAmazon BedrockOpenAI APILocal (Ollama etc.)
DeploymentServerless inside AWSProvider's cloudYour own server
Data locationThe AWS Region you choose (the profile's Regions if a cross-Region inference profile is used)Provider's infrastructureFully on-premises
Model choiceMultiple providersProvider's modelsOpen-weight models
Cost modelPer token (or reserved capacity)Per tokenHardware and energy
AWS service integrationNative (IAM, Lambda, S3)ExternalManual

According to AWS documentation, Bedrock does not use your prompts and responses to train models and does not share them with model providers. If data must never leave the plant, on-premise AI with Ollama is the better fit.

How is the architecture set up?

ZMA / GDT ──Modbus──► IoT Gateway ──MQTT/TLS──► AWS IoT Core
                                                    │
                                                    ▼
                                         Time-series database
                                                    │ (hourly)
                                                    ▼
                                    Lambda: statistics + anomaly detection
                                                    │ summary only
                                                    ▼
                                        Amazon Bedrock (Converse API)
                                                    │
                                     ┌──────────────┴──────────────┐
                                     ▼                             ▼
                              SNS / email alarm             S3: report archive

The key point is that Bedrock receives the summary computed in Lambda, not raw data. This improves accuracy and lowers token cost.

Application 1: Explaining an anomaly

We pass statistics computed in Lambda from ZMA Data Acquisition data to the model and ask for a structured interpretation. The example uses the model-agnostic Converse API; choose the model ID according to the current model enabled for your account and Region in the Bedrock console.

import json
import boto3

bedrock = boto3.client('bedrock-runtime', region_name='eu-west-1')
MODEL_ID = '<model-or-inference-profile-id-from-bedrock-console>'

summary = {
    "device": "ZMA-Tank1",
    "window": "last 1 hour",
    "temperature": {"mean": 22.3, "max": 45.8, "z_max": 6.1},
    "vibration_rms": {"mean": 0.06, "last_10min": 0.14, "trend": "rising"},
}

response = bedrock.converse(
    modelId=MODEL_ID,
    system=[{"text": "You are an industrial maintenance expert. Rely only on the data given, "
                     "say so where you are unsure. Respond in JSON."}],
    messages=[{"role": "user", "content": [{"text":
        "Interpret this summary; fields: anomalies, probable_causes, urgency "
        "(low/medium/high), recommended_checks.\n" + json.dumps(summary)}]}],
    inferenceConfig={"maxTokens": 600, "temperature": 0.2},
)

text = response['output']['message']['content'][0]['text']
usage = response['usage']   # inputTokens / outputTokens: log these to track cost

Example (illustrative) output:

{
  "anomalies": ["Single temperature peak of 45.8 °C (z ≈ 6)", "Rising trend in vibration RMS"],
  "probable_causes": ["Cooling fault or sensor/cable error", "Possible onset of bearing wear"],
  "urgency": "high",
  "recommended_checks": ["Check the temperature sensor and its cable", "Measure motor vibration on site"]
}

The model's output is a recommendation; alarm thresholds and urgency decisions should be made in the statistics layer with deterministic rules.

Application 2: Natural-language data queries

Operator: "What was tank 3's average fill level last week?" The model generates SQL against the schema you provide. Before running the generated query, for safety:

  • Give the database user read-only permissions.
  • Verify in code that the query contains only SELECT and includes a time filter.
  • Cap the number of result rows.
-- Example query generated by the model
SELECT AVG(weight_kg / capacity_kg * 100) AS avg_fill_percentage
FROM tank_data
WHERE tank_id = 3
  AND timestamp >= DATE_SUB(NOW(), INTERVAL 7 DAY);

Application 3: Generating maintenance reports

The weekly alarm list, calibration records and device statistics are passed to the model as JSON; the model drafts a report with sections such as "summary, status per device, alarms, recommended work." The report can be saved to S3 and emailed. Because the report does not need to be real-time, this job is a good candidate for batch inference, which is offered at a lower price for selected models.

Application 4: Answers from manuals (RAG)

Amazon Bedrock Knowledge Bases splits PDF manuals stored in S3 into chunks, vectorises them with an embedding model and stores them in a vector store. At query time the relevant chunks are retrieved and given to the model as sources; the answer comes back with citation information.

agent_rt = boto3.client('bedrock-agent-runtime', region_name='eu-west-1')

resp = agent_rt.retrieve_and_generate(
    input={'text': 'Which checks should be made if load cell zero drift is observed?'},
    retrieveAndGenerateConfiguration={
        'type': 'KNOWLEDGE_BASE',
        'knowledgeBaseConfiguration': {
            'knowledgeBaseId': '<kb-id>',
            'modelArn': '<model-arn>',
        },
    },
)
print(resp['output']['text'])
for c in resp['citations']:
    print([r['location'] for r in c['retrievedReferences']])

For more on the concept, see the RAG glossary entry. For domain knowledge, RAG should usually be tried first; Bedrock also offers fine-tuning for selected models, but that requires more labelled data and cost.

How do Guardrails restrict responses?

With Amazon Bedrock Guardrails you can deny unwanted topics (e.g. financial data), mask personal data and apply content filters. A guardrail you create is attached to the Converse call:

response = bedrock.converse(
    modelId=MODEL_ID,
    messages=messages,
    guardrailConfig={"guardrailIdentifier": "<guardrail-id>", "guardrailVersion": "1"},
)

How is cost calculated?

On-demand usage in Bedrock is billed by input and output tokens; the unit price depends on the model and Region. Scenario: hourly anomaly interpretation for 10 tanks, prompt ~500 tokens, response ~200 tokens.

Calls         : 10 tanks × 24 × 30 days   = 7,200 calls/month
Input tokens  : 7,200 × 500               = 3.6 million
Output tokens : 7,200 × 200               = 1.44 million

Monthly cost = 3.6 × P_input + 1.44 × P_output   (P: price per 1 million tokens)

Take the current P values from the Bedrock pricing page and plug them into the formula. To reduce cost: send summaries only, pick small/fast models for simple tasks, limit responses with maxTokens, and move non-real-time work to batch. Logging the usage field of the Converse response is the easiest way to track actual consumption.

Summary: checklist for adding Bedrock to an industrial project

  • Detect anomalies with statistics; use Bedrock for interpretation and reporting.
  • Send computed summaries to the model, not raw data.
  • Keep the model ID in configuration rather than hard-coding it; models are updated over time.
  • Run generated SQL only with a read-only user and after validation.
  • Restrict access with Guardrails and IAM; log token usage.