-
Notifications
You must be signed in to change notification settings - Fork 220
Closed
Labels
automation-exemptThis issue will not be closed by autoclose actionThis issue will not be closed by autoclose actionfeature-requestA feature should be added or improved.A feature should be added or improved.p2This is a standard priority issueThis is a standard priority issue
Description
- I've searched for previous similar issues and didn't find any solution
Platform/OS/Device
macOS Catalina, python3.8
Describe the question
I faced with a weird behaviour using SDK and policy variables. The problem is that when I use AWS IoT Core policy variables then I'm not able to even connect to IoT Service.
Steps:
- Create a thing in AWS IoT Registry, e.g.
dummy(without any certificates). - Create a policy document:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "iot:Connect",
"Resource": [
"arn:aws:iot:us-east-1:XXXXXXXX:client/${iot:Connection.Thing.ThingName}"
]
}
]
}
- Attach a principal to the policy.
- Configure IAM roles.
- ...
Then I'm trying to connect:
mqtt_connection = mqtt_connection_builder.websockets_with_default_aws_signing(
endpoint=host,
client_bootstrap=client_bootstrap,
region='us-east-1',
credentials_provider=credentials_provider,
websocket_proxy_options=None,
ca_filepath=path_to_file,
on_connection_interrupted=on_connection_interrupted,
on_connection_resumed=on_connection_resumed,
client_id='dummy',
clean_session=False,
keep_alive_secs=6)
connect_future = mqtt_connection.connect()
connect_future.result()
with the following result:
AwsCrtError: AwsCrtError(name='AWS_ERROR_MQTT_UNEXPECTED_HANGUP', message='The connection was closed unexpectedly.', code=5134)
However, when I change the policy document to a "hardcoded" thing name value (dummy) it works:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "iot:Connect",
"Resource": [
"arn:aws:iot:us-east-1:XXXXXXXX:client/dummy"
]
}
]
}
Metadata
Metadata
Assignees
Labels
automation-exemptThis issue will not be closed by autoclose actionThis issue will not be closed by autoclose actionfeature-requestA feature should be added or improved.A feature should be added or improved.p2This is a standard priority issueThis is a standard priority issue