IMD SolutionComputing LibraryShop main store

Troubleshooting

Why a PC SCADA MQTT client fails against AWS IoT Core

Edge computing and IIoT Published 10 min read By IMD Solution engineering team

Short answer

AWS IoT Core refuses the TLS session unless the SCADA host presents an activated client certificate, so a client that works on a public broker still fails there. Point the port at the account's endpoint with TLS enabled, create the certificate in AWS IoT Core from a CSR generated on the host, import it into the Personal store of the Windows account running the SCADA application, and select it on the port's TLS tab.

On this page
  1. Why does an MQTT client that works on a public broker fail on AWS IoT Core?
  2. What broker address and port does the SCADA MQTT client need for AWS IoT Core?
  3. Which client certificate does AWS IoT Core require from the SCADA host?
  4. How do you create the AWS IoT Core certificate from the CSR?
  5. Why does the imported certificate not appear on the port's TLS tab?
  6. What does the certificate chain error on the SCADA host mean?
  7. What belongs in the MQTT Client ID and topic fields?
  8. How do you commission and verify the connection in order?
  9. Questions asked

Your SCADA MQTT client works against a public broker and fails against AWS IoT Core because AWS IoT Core will not complete a TLS session without a client certificate — and a certificate dropped into the Windows store the wrong way never reaches the port's TLS tab. The fix is four steps: point the port at the account's endpoint on port 8883 with TLS enabled, create the client certificate in AWS IoT Core from a certificate signing request (CSR) generated on the host, import it into the Personal store of the Windows account that runs the SCADA application, then select it on the port's TLS tab. Below are the values that decide each step, the certificate-chain error with its PFX remedy, and the order to commission and verify the path.

Why does an MQTT client that works on a public broker fail on AWS IoT Core? #

AWS IoT Core stops the TLS handshake unless the SCADA host presents an activated client certificate, while most public test brokers accept any session, so the same driver settings that work publicly prove nothing about the AWS path.

A working public-broker session proves three things and no more: the driver is configured, the host can open outbound TCP, and TLS negotiates against a broker that asks for no identity. It is the same gap covered in why an MQTT client connects without its TLS client certificate — a permissive broker never demands what AWS demands.

The path has four hops, and each fails on its own:

  • TCP: the host resolves the endpoint and opens the TLS port through routing and the outbound firewall.
  • TLS: the host validates the broker's chain and presents its own client certificate.
  • Authorization: AWS accepts only a certificate that is active and carries a policy; the policy decides which connections and subscriptions that identity may perform.
  • Session: the broker takes the Client ID at CONNECT and the topic at SUBSCRIBE.

The device already publishing to your topic proves that device's four hops. It proves nothing about the SCADA host's, because the PC needs its own provisioned identity — which is what the rest of this article builds.

What broker address and port does the SCADA MQTT client need for AWS IoT Core? #

Use the AWS IoT Core endpoint shown in the account's connection details as the broker address — in the setup described here, one ending in -ats.iot.us-east-1.amazonaws.com — with port 8883 and TLS enabled on the port.

The endpoint is the broker host and nothing else: not the Client ID, not a topic. Take it from the endpoint field of the AWS MQTT test client's connection details, not from any sample value beside it. Enabling TLS on the port starts the handshake and exposes the certificate selection the later steps depend on.

Setting Value in the working setup What it does
Port address the account's data endpoint, suffix -ats.iot.us-east-1.amazonaws.com in this example destination host for the TCP connection
Port number 8883 TLS-protected MQTT port used in this setup
Enable TLS enabled starts the handshake and exposes the certificate selection
MQTT Client ID the Client ID from the AWS MQTT test client's connection details session identity AWS sees at CONNECT
Host ID default, unchanged driver-internal field with no AWS role in this setup
Topic the topic the device publishes to subscription filter that feeds the tag

A test against a public test broker on these same settings isolates the driver and the network path; it does not touch AWS certificates, policies or Things, so treat it as diagnostic only. Send only test values there — anyone can subscribe to a public topic, so never point live plant tags at it.

Which client certificate does AWS IoT Core require from the SCADA host? #

AWS IoT Core requires an X.509 client certificate created inside your AWS account — here from a certificate signing request generated on the SCADA host itself — set to active, attached to a policy and attached to a Thing before the first connection succeeds.

TLS on this path carries two identities at once. On the broker side, the host must trust the chain AWS presents — that trust is the subject of the chain error further down. On the client side, the host must present a certificate AWS recognizes, and that certificate, not a user name or a connection string, is the identity AWS authorizes. The rule your publishing device already followed — a certificate and key copied onto it before it would connect — applies equally to the PC.

Generate the request with the certificate utility that ships with the SCADA package, commonly found in its thin-client or web-server setup on an SSL certificate form. The utility creates the key pair on the host and copies the request to the Windows clipboard; paste it into a text editor and save it with a .csr extension. Because the private key never leaves the host, the certificate AWS returns will pair with it at import time.

How do you create the AWS IoT Core certificate from the CSR? #

Open the AWS IoT console, go to Certificates under Security, choose Create, select the option to create the certificate with a certificate signing request, upload the saved .csr file, and set the status to active before downloading the certificate.

The steps around that console action:

  1. In the SCADA certificate utility's SSL certificate form, enter the same AWS endpoint the port uses as the Host + Domain value, then generate the request.
  2. Paste the clipboard content into a text editor and save the file with a .csr extension.
  3. After the console returns the certificate, attach it to a policy that allows the connect and the subscribe you need, and attach it to a Thing.

The console route is the manual one; the same operation is the API CreateCertificateFromCsr, exposed as create-certificate-from-csr in the AWS CLI and as create_certificate_from_csr in Boto3. For several hosts, AWS documents collecting multiple .csr files in one directory and specifying that directory; at fleet scale it also documents certificate providers and CSR-based fleet provisioning, which is more than one SCADA host needs.

One documented rule decides whether the create call succeeds at all: AWS accepts the request only when its public key is RSA of at least 2048 bits, or an ECC key on the NIST P-256, P-384 or P-521 curves.

Worked example with hypothetical numbers: the utility's key-size option is set to RSA 1024 bits. 2048 − 1024 = 1024 bits short of the rule, so the create call fails and there is nothing to download. Regenerate at 2048 bits — exactly the minimum, accepted — or at 3072 bits, which clears the minimum by 3072 − 2048 = 1024 bits. A P-256 key qualifies by its curve, with no length arithmetic to do. Decision: regenerate at RSA 2048 bits or larger, or on one of the three curves, and import nothing until AWS hands back a certificate.

Why does the imported certificate not appear on the port's TLS tab? #

The TLS tab lists only certificates in the certificate store of the Windows account the SCADA application runs under, so a certificate imported for a different account, or imported without its private key, stays invisible even though the import reported success.

Two import mistakes produce exactly this symptom:

  • Wrong account: the import went into an administrator's own store or the machine-wide store while the SCADA runtime runs under another account. Open the services console, read the account the SCADA application logs on as, and import for that account.
  • No private key: a bare certificate file downloaded from AWS imports as a public certificate only. A client identity needs its matching private key, and the CSR route guarantees the pair because the utility generated the key on the host.

Not every driver reads the Windows store: some MQTT client agents import and keep the client certificate in their own administration settings, so confirm where your driver looks before importing anywhere.

The working sequence for a Windows-store driver: import the returned AWS certificate through the Windows certificate manager (MMC) into the Current User store, under Personal, signed in as the account that runs the SCADA application. Reopen the application and the certificate appears on the port's TLS tab — select it there. In the setup this article follows, feeding the returned certificate back through the SCADA utility's own processing step produced an error; the MMC import is what made the certificate selectable.

What does the certificate chain error on the SCADA host mean? #

The message "A certificate chain could not be built to a trusted root authority" means Windows, for the user in question, cannot build a trusted path from the certificate being processed to a root in that user's store — a trust-placement fault, not a wrong client certificate.

The error appeared while processing a certificate through the SCADA utility even after the AWS root certificates were installed — installed, but not trusted for the account that needed them. The remedy that resolved it: convert the AWS root certificate to PFX with a conversion tool such as OpenSSL, then install that PFX into the certificate store of the same Windows user the SCADA application runs as. One conversion, one store, the same account as the client-certificate import.

Keep the two roles apart while you do this. The root certificate anchors trust for the chain the broker presents; the client certificate proves the host's own identity to AWS. Installing the root does not replace selecting the client certificate on the TLS tab, and a root certificate never goes into the client-identity selection.

What belongs in the MQTT Client ID and topic fields? #

Set the MQTT Client ID to the Client ID shown in the AWS MQTT test client's connection details, leave the driver's Host ID at its default, and point the tag at the topic the device actually publishes to — the endpoint belongs in neither field.

Three values do three jobs at three moments: the endpoint is the TCP destination, the Client ID is the session identity in the CONNECT packet, and the topic is the subscription filter in SUBSCRIBE. Putting the endpoint into the Client ID field can produce a session that connects while delivering nothing — which looks like a certificate problem and is not one.

How do you commission and verify the connection in order? #

Commission in the order TCP, TLS, authorization, session: prove the host reaches the endpoint, complete the handshake with the selected certificate, confirm AWS accepts the identity, then confirm the tag receives a publication with a fresh timestamp.

Work the hops in that order and stop at the first one that fails, the discipline spelled out for finding the failing hop when MQTT TLS connects but no CONNACK arrives:

  1. From the SCADA host, open a TCP session to the endpoint on the TLS port; a blocked outbound rule stops everything after this step.
  2. Select the imported certificate on the port's TLS tab and restart the port.
  3. In the console, confirm the certificate is active, carries its policy and is attached to its Thing.
  4. Publish a test message to the topic from the AWS MQTT test client and watch the tag's timestamp advance; in the working setup the tag, which had sat at its initial value, showed the latest published data from this point on.

The decision for each symptom:

  • The TLS tab is empty: the certificate is in the wrong account's store or has no private key — import the CSR-based certificate into the runtime account's own store.
  • The chain error appears: convert the AWS root to PFX and install it into that same account's store.
  • The session connects and the tag never updates: the Client ID, the topic filter or the policy is wrong — TLS is fine, stop touching certificates.
  • The connection never opens: routing or the outbound firewall on the TLS port.
  • Everything above checks out and the handshake still fails: check the host clock, because a wrong clock breaks certificate validation against AWS IoT Core even with a valid client certificate, as shown in why a PLC ping works but AWS IoT Core MQTT fails when the clock is wrong.

Questions asked

Can the SCADA host reuse the certificate and key already on the publishing device?

It can technically present them, but do not: in AWS IoT Core each certificate is a separate identity, and the policy attaches to that certificate, so a shared pair means one policy governs both the device and the host, and revoking or rotating the certificate takes both offline at once. Generate the SCADA host's own request and certificate so each endpoint is audited and revoked independently.

Why does the MQTT tag sit at a value of 0 while the client is connecting?

A numeric tag commonly initializes to 0 before its first publication, so the value alone says nothing about the connection. Read the tag's timestamp and quality instead: a timestamp that never advances after the port connects means no publication is arriving, while a bad quality code means the driver is reporting the connection failure itself.

Can the CSR come from OpenSSL instead of the SCADA certificate utility?

Yes. AWS IoT Core accepts any CSR whose key meets the documented key rule, because the request carries only the public key. The difference is who holds the private key: with the SCADA utility it is generated on the host, but with an external tool you hold it yourself, so after AWS returns the certificate you must import the certificate together with its private key, for example as a PFX file, into the runtime account's Personal store before the TLS tab can select it.

Does a working AWS MQTT test client prove the SCADA host will connect?

No. The test client runs in the browser under your AWS sign-in, with no client certificate on the PC, so it proves the topic, the endpoint and your account access but nothing about the host's certificate, its policy or the port configuration. Its value in this procedure is limited to the connection details it displays and the test messages it publishes.

Keep reading

  • How-to

    Bridge a cellular tracker's TCP stream into MQTT for AWS IoT Core

    Build a small ingest service on your edge PC: it terminates the tracker's raw TCP session, decodes each stored record, and republishes one MQTT message per fix over TLS on port 8883. Acknowledge a packet only after every publish is confirmed, or a coverage-gap batch is silently lost.

    Edge computing and IIoT

  • Troubleshooting

    Fixing MQTT cloud broker data not reaching SCADA tags

    Get the gate right first: MQTT over TLS belongs on port 8883, with the TLS mode and client identity the broker actually requires. An independent client such as MQTT Explorer on the same PC proves only its own settings, not the driver's. If the driver cannot perform the service-specific handshake Azure IoT Hub needs, no tag mapping will ever fill.

    Edge computing and IIoT

  • Troubleshooting

    PLC ping works but AWS IoT Core MQTT fails when the clock is wrong

    Check the controller clock first. Ping and DNS prove IP reachability only; with the PLC clock set to 2007, TLS rejects every current AWS IoT Core certificate as not yet valid and the handshake dies before MQTT CONNECT, which is why the same project works in simulation on the PC's clock. Connect the clock battery, set the time, enable the NTP client against a plant time server, then retest DNS, port 8883, TLS, CONNACK and publish.

    Edge computing and IIoT

Why the Flexy AWS IoT script fails at MQTT CONNECT with error 28