you simply have to authorize your IAM user to access to the buvket, within the S3 bucket policy, like so:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "whatever",
"Effect": "Allow",
"Principal": {
"AWS": [
"<ARN OF YOUR IAM USER>"
]
},
"Action": [
"s3:ListBucket",
"s3:GetBucketLocation",
"s3:GetObject"
],
"Resource": [
"arn:aws:s3:::<YOUR BUCKET NAME>",
"arn:aws:s3:::<YOUR BUCKET NAME>/*"
]
}
]
}
Then, because this is cross account, you also have to allow your IAM user to perform S3 calls, by attaching a policy to your IAM user, like so:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "whateveryoulike",
"Effect": "Allow",
"Action": [
"s3:*"
],
"Resource": [
"arn:aws:s3:::<BUCKET_NAME>",
"arn:aws:s3:::<BUCKET_NAME>/*"
]
}
]
}
simply configure your cli, and you will be able to access your bucket cross account.