Search code examples
aws-device-farm

Does calling createUpload in aws devicefarm actually upload the file?


I'm switching from using the aws cli to the sdk so I can make some nicer scripts but it seems i'd still have to curl after calling createUpload. Is there a nicer way of doing this? Or something that does the upload in one?


Solution

  • createUpload just creates a S3 bucket with a pre-signed key, you still have to do a put to the bucket to actually upload anything, I don't think there is a single command that combines the two.

    This is how I do it in Python:

    upload = device_farm.create_upload(projectArn=project['arn'], name='spec.yml', type='APPIUM_WEB_PYTHON_TEST_SPEC')
    response = requests.put(upload['upload']['url'], data= open('testspec.yml', 'rb'), headers={"Content-Type": "application/x-www-form-urlencoded"})