I have a Lambda and I'm attempting to publish to an IoT core via the SDK. However I'm getting an error
{
"errorMessage": "MissingEndpoint: 'Endpoint' configuration is required for this service",
"errorType": "baseError"
}
Here's my publish function:
func publish() error {
session := session.New(&aws.Config{
Region: aws.String("eu-west-2"),
})
iot := iotdataplane.New(session)
input := &iotdataplane.PublishInput{
Payload: []byte("take picture"),
Topic: aws.String("take-picture"),
}
resp, err := iot.Publish(input)
if err != nil {
return err
}
return nil
}
Here are some IAM/roles stuff I've added as part of my serverless config:
provider:
name: aws
runtime: go1.x
region: eu-west-1
iamRoleStatements:
- Effect: "Allow"
Action:
- "iot:Publish"
Resource: ["arn:aws:iot:eu-west-2:<redacted>:thing/mini-camera"]
- Effect: "Allow"
Action:
- "iot:Connect"
Resource: ["*"]