HumanSignal/label-studio-sdk

IAM policy is needed to use S3

laxmimerit opened this issue · 0 comments

Hi,
What IAM policy do I need to attach for s3 import configuration? I am using this method to attach s3 with the Label Studio project.

def connect_s3_bucket(project, target_awspath):
	project.connect_s3_import_storage(awsbucket_name, prefix=target_awspath, aws_access_key_id=config['aws_access_key_id'],
									aws_secret_access_key=config['aws_secret_access_key'], region_name = config['region'])

	print("Connected S3 Bucket Successfully!!!")

I have given this permission in the IAM policy

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor1",
            "Effect": "Allow",
            "Action": [
                "s3:ListBucket",
                "s3:GetObject",
                "s3:PutObject",
                "s3:DeleteObject"
            ],
            "Resource": [
                "arn:aws:s3:::<my_bucket_name>",
                "arn:aws:s3:::<my_bucket_name>/*"
            ]
        }
    ]
}

It is giving me 500 internal error.