I am using sam
for setting up infrastructure. During sam deploy
, uploading the artifacts to s3 bucket is failing with error
botocore.exceptions.ClientError: An error occurred (403) when calling the PutObject operation: Forbidden
I am a root user by the way, I have all the necessary permissions. I verified that I have necessary permission by running the command. This is able to successfully upload the object to s3 but failing during sam deploy
.
aws s3api put-object --bucket sam-app --key test --body test.txt
I tried everything:
- Enabled the public access for the bucket
- Properly set the bucket policy
Please help why the explicit s3 put-object is successful in aws cli but why it’s failing with sam deploy.
FYI, I am running sam deploy
and put-object
cli command on sam bucket i.e sam-app