Amazon S3 - Unable to create a datasource

雨燕双飞 提交于 2019-12-12 05:05:56

问题



I tried creating a datasource using boto for machine learning but ended up with an error.
Here's my code :

import boto

bucketname = 'mybucket'
filename = 'myfile.csv'
schema = 'myfile.csv.schema'
conn = boto.connect_s3()
datasource = 'my_datasource'

ml = boto.connect_machinelearning()

#create a data source
ds = ml.create_data_source_from_s3(
data_source_id = datasource,
data_spec ={
    'DataLocationS3':'s3://'+bucketname+'/'+filename,
    'DataSchemaLocationS3':'s3://'+bucketname+'/'+schema},
data_source_name=None,
compute_statistics = True)

print ml.get_data_source(datasource,verbose=None)

I get this error as a result of get_data_source call:

Could not access 's3://mybucket/myfile.csv'. Either there is no file at that location, or the file is empty, or you have not granted us read permission.

I have checked and I have FULL_CONTROL as my permissions. The bucket, file and schema all are present and are non-empty. How do I solve this?


回答1:


You may have FULL_CONTROL over that S3 resource but in order for this to work you have to grant the Machine Learning service the appropriate access to that S3 resource.

I know links to answers are frowned upon but in this case I think its best to link to the definitive documentation from the Machine Learning Service since the actual steps are complicated and could change in the future.



来源:https://stackoverflow.com/questions/31221281/amazon-s3-unable-to-create-a-datasource

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!