Configuring Ignition Gateway Events to Publish to AWS SNS

Patricia Callen6 min read
Application NoteOther ManufacturerSCADA Configuration
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

The goods-movement event appears in Ignition and reaches the SQL database, but the downstream system needs it on an AWS SNS topic instead. Intercept the event at the Gateway, validate its tag value and event semantics, then publish from a Gateway-scoped script. A custom module is usually unnecessary unless packaging, lifecycle control, or reusable integration code justifies the added complexity.

Where should the goods-movement event be intercepted?

Start at the point where physical movement becomes an Ignition event. If a tag value changes when goods move, a Gateway tag change script is the direct interception point. It runs independently of an open client session and can construct a message before the existing SQL insert occurs.

Look at the tag trend first. Confirm that one physical movement produces the intended transition, at the intended time, with good quality. If the movement exists only inside transaction, application, or database-writing logic, intercept it there instead; adding a second tag-change path could publish a different representation of the event.

Signal Source Wrong-value symptom
Movement state or count Ignition tag Missing, duplicated, or reversed movement events
Previous and current values tag change event Publication on irrelevant transitions
Quality and timestamp Tag event metadata Stale or invalid process data published as current
Constructed payload Gateway script Correct trigger with incomplete business data
Publish result SNS API response or exception Script executes but no message reaches SNS
Received message Downstream SNS consumer Acknowledged publication without usable processing

Does the tag transition represent one business event?

Read the previous value, current value, timestamp, and quality for several real movements. A level such as “moving” describes state; an edge such as “not moving to moving” can represent an event. Publishing on every value update can create duplicates when the value repeats, quality changes, or the source reconnects.

If one transition maps to one movement, define that transition explicitly in the Gateway script. If several tags together define movement, evaluate them as one condition and capture their values from the same logical observation. If the database logic currently creates a movement record only after validation, reproduce that validation before replacing it. Tuning or timing changes do not fix an incorrectly selected signal.

Decide what makes an event unique. Include an application-level event identifier when the source provides one. If it does not, define a deterministic identity from stable process fields rather than relying only on arrival time. This gives the consumer a basis for rejecting duplicate deliveries or retries.

Is the Gateway script receiving the correct data?

Add diagnostic logging around the trigger before enabling SNS publication. Record the trigger decision, quality, event timestamp, payload identity, and success or failure state. Avoid logging credentials or sensitive payload fields.

If no log entry appears, the problem is upstream of SNS: check the tag event binding, Gateway scope, enabled state, and the actual value transition. If entries appear with wrong values, correct tag selection or payload mapping. If the payload is correct, continue to connectivity and authentication checks.

Keep the callback short. Network publishing can take longer than a tag event handler should occupy its execution path. Hand the validated event to a controlled asynchronous worker or queue when the implementation provides one. Bound concurrency so a burst of movements does not create an unbounded number of outbound calls.

Can the Gateway reach and authenticate to AWS SNS?

The evidence alternates between an SNS endpoint and an SNS topic. Resolve that distinction before coding: the publisher normally targets the configured SNS topic, while subscriber endpoints receive messages distributed by that topic. Read the exact publish destination from the AWS configuration rather than constructing it from memory.

From the Ignition Gateway host, test name resolution, outbound network access, certificate trust, and AWS authentication through the same route the production script will use. A successful test from an engineering workstation does not prove the Gateway can connect. If the Gateway cannot reach AWS, correct routing, proxy, firewall, or trust configuration before changing the tag logic.

Use a credential source intended for unattended service execution and grant only the publish access required for the selected topic. Keep credentials out of tag values, project scripts, payloads, and logs. If authentication fails, inspect the returned AWS error and the Gateway log; repeated script edits will not correct an access-policy or credential problem.

What happens when publication fails?

Replacing the SQL insert removes the database record that may currently provide durability, audit history, and recovery. Direct SNS publishing is only equivalent if the system has a defined response to network loss, throttling, Gateway restart, and rejected messages.

Choose the required delivery behavior before cutting over. If dropping a movement event is acceptable, log the failure with enough identity to reconcile it. If loss is unacceptable, store failed events in a durable local queue or retain the database path as an outbox until SNS acknowledges publication. Retry transient failures with bounded attempts and delay; route permanent payload or authorization failures for operator action.

Publication success proves that SNS accepted the request, not that the downstream application processed the message. Track at least two states: publisher acceptance and consumer processing. Use the same event identity at both points to distinguish a publishing failure from a subscriber or application failure.

How should the resolving branch be implemented and verified?

  1. Identify the exact Ignition tag or application condition that represents a completed goods movement.
  2. Trend the source and record previous value, current value, timestamp, and quality across multiple movements.
  3. Define the qualifying transition and the fields required by the downstream system.
  4. Create a Gateway tag change script for that transition, or place the call in the existing validated event logic when the tag alone is insufficient.
  5. Build and validate the payload locally. Reject bad quality, missing required fields, and nonqualifying transitions before making a network call.
  6. Publish through an AWS-authenticated client to the configured SNS topic. Capture the publish result and classify failures as transient or permanent.
  7. Add bounded retry and durable buffering if the process cannot tolerate event loss.
  8. Test with a controlled movement. Match the source timestamp and event identity through the Gateway log, SNS acceptance, and downstream consumer.
  9. Run repeated movements and a connection-failure test. Verify that duplicates are handled, queued events recover as designed, and the tag callback remains responsive.
  10. Disable the SQL insert only after event counts and payload contents match across the old and new paths for an agreed validation period.

Use a script when the integration is limited and maintainable within the Gateway project. Consider a module when the organization needs a packaged component, centralized configuration, stronger lifecycle management, or reuse across many Gateways. The module does not remove the need to validate the signal chain, credentials, retries, and delivery semantics.

FAQ

Why does the Ignition script publish duplicate SNS messages?

The trigger may be responding to every update rather than one qualifying edge, or a retry may resend an accepted event. Compare previous and current tag values, assign a stable event identity, and make the consumer idempotent.

Why does the tag change but nothing reach AWS SNS?

Check for a Gateway log entry first. No entry points to the event configuration or trigger condition; a logged exception points to payload, network, certificate, authentication, or topic-access handling.

Why does SNS accept the message but the application sees nothing?

SNS acceptance and subscriber processing are separate checkpoints. Trace the same event identity through the publish result, subscription delivery path, and consumer log.

Why should I keep a queue if SNS is replacing SQL?

The SQL record may currently survive outages and Gateway restarts. A durable queue or outbox preserves movement events when direct publication cannot complete.

When should I stop troubleshooting and contact official support?

Stop after reproducing the failure with a known qualifying tag transition, a validated payload, and captured Gateway and AWS errors. Contact Inductive Automation support for Gateway scripting or runtime failures, and AWS Support for SNS authentication, topic policy, or service-side rejection. Provide timestamps, sanitized logs, the failing execution scope, and the AWS error without sending credentials.

Back to blog