Skip to content

Connecting ESP32 with AWS IoT Core using MQTT #961

Answered by phoddie
nickthiru asked this question in Q&A
Discussion options

You must be logged in to vote

It is has been a little while since I've brought-up an AWS client. The configuration is complex because you need both the AWS site certificate and the client certificate pieces. Here's an example of making a secure MQTT connection to AWS with a device key & certificate.

new MQTT({
	host,
	id,
	port: 8883,
	Socket: SecureSocket,
	secure: {
		cache: false,
		protocolVersion: 0x303,
		certificate: new Resource("AmazonRootCA1.der"),
		clientKey: new Resource("device.key.der"),
		clientCertificates: [new Resource("device.crt.a.der"), new Resource("device.crt.b.der")],
		verify: true,
		trace: true
	},
});

Note: This example shows two client certificates for completeness. However, in most situa…

Replies: 1 comment 10 replies

Comment options

You must be logged in to vote
10 replies
@nickthiru
Comment options

@phoddie
Comment options

@nickthiru
Comment options

@phoddie
Comment options

@nickthiru
Comment options

Answer selected by nickthiru
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants