aws_iot_connect with policie and client_id

Hi all,

I have a custom board with an 9151, I want to use mqtt with aws, it's works I'm able to connect aws, but I have a question about

aws_iot_connect()

If I want to be able to connect on AWS, I have to use a very simple policie like that:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "iot:*",
      "Resource": "*"
    }
  ]
}

But If I try to use something like that

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "iot:Connect",
        "iot:Publish",
        "iot:Receive",
        "iot:Subscribe"
      ],
      "Resource": [
        "arn:aws:iot:*******:client/TryIt",
        "arn:aws:iot:*******:topic/ABC/359404230602222/*",
        "arn:aws:iot:*******:topicfilter/ABC/359404230602222/*"
      ]
    }
  ]
}

AWS reject me as soon as I try to connect, so if I understand well TryIt is my client_id so here is what I've done in my main

	LOG_INF("Connecting to AWS IoT");

	struct aws_iot_config config = {
		.client_id = "TryIt"
	};

	err = aws_iot_connect(&config);
	if (err) {
		LOG_ERR("aws_iot_connect, error: %d", err);
	}

Why I've missed ?

Parents Reply Children
No Data
Related