Presign URL for AWS IoT https / mqtt client
See original GitHub issueHi!
Trying to get a websockets from web-browsers to work through AWS IoT by presigning a URL which is delivered to the web-browser/client but it seems there is no way for boto3 to presign a URL with the method “GET” which is the method used to access IoT Websockets (as far as i understand at least)
Code:
import boto3
sts = boto3.client('sts')
creds = sts.assume_role(RoleArn="arn:aws:iam::000000000000:role/service-role/test", RoleSessionName="web-client-some-ip")
iot = boto3.client(
'iot',
aws_access_key_id=creds['Credentials']['AccessKeyId'],
aws_secret_access_key=creds['Credentials']['SecretAccessKey'],
aws_session_token=creds['Credentials']['SessionToken'])
print(iot.generate_presigned_url('GET', ExpiresIn=3600))
Traceback:
Traceback (most recent call last):
<flask traceback dropped>
File "/home/oskar/Code/project/web.py", line 96, in get_live_feed
print(iot.generate_presigned_url('GET', ExpiresIn=3600))
File "/home/oskar/venv/lib/python3.6/site-packages/botocore/signers.py", line 563, in generate_presigned_url
raise UnknownClientMethodError(method_name=client_method)
botocore.exceptions.UnknownClientMethodError: Client does not have method: GET
According to the docs it is possible to presign url’s for https connections to AWS IoT gateway, but there seems be something missing in boto to support it.
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Managing jobs - AWS IoT Core - AWS Documentation
Presigned URLs. Your job document can contain a presigned Amazon S3 URL that points to your code file (or other file). Presigned Amazon...
Read more >Generate a presigned request with the WebSocket library
The following shows how you to generate a presigned request so that you can use the ... If your URL doesn't include the...
Read more >Sample Python code to generate presigned URL
The following code shows an example for generating the pre-signed URL using Python as the programming language. Pre-requisites.
Read more >PresignedUrlConfig - AWS IoT
Pre-signed URLs are generated when Jobs receives an MQTT request for the job document. Type: Long. Valid Range: Minimum value of 60. Maximum...
Read more >Connecting to AWS IoT Core by using custom authentication
The following example demonstrates how to pass credentials through the HTTP Upgrade request. GET /mqtt HTTP/1.1 Host: your-endpoint Upgrade ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sure, just pasting it here.
Of course all ‘\n’ were reinterpreted as actual newlines so i had to fix that manually, I hope i didn’t miss something more.
Did anybody solve this? It seems related to the length of the URI.
This is my really simple example with
paho-mqtt
: