We can create a policy using the IAM visual editor as follows:
- Log in to the console as an administrator and go to the IAM dashboard.
- Click on Policies from the left sidebar.
- Click on Create Policy. This will provide us with a visual editor:
We can also click on the JSON tab and enter the JSON directly if we have already created the policy JSON.
- Set the Service to S3.
- Select ListBucket under Actions.
- Under Resources, select Specific, click on Add ARN, and enter our bucket's ARN in the format arn:aws:s3:::<bucket_name>.
- Under Request conditions, click Add condition and add a condition, as follows, ...