Option if your Confluence is hosted on AWS EC2, you can manage S3 permissions through Roles. i.e. Identify your EC2 role and add permissions (i.e. S3FullAccess).
Create IAM user with S3 Permissions i.e. go to Identity & Access Management (IAM) → Users → Click Add User
Username: e.g. s34confluence
Access Type: Programmatic access
Set permissions: Click Attach existing policies directly → Choose Policy (AmazonS3FullAccess)
Click Create user.
That's it, take the note of Access Key ID & Secret Access keys.
Option if you don't like to manage IAM access keys in Confluence.
In Confluence, Create S3 Bucket without Access key ID and Secret access key.
Go to your Confluence host, copy Access key ID and Secret access key to ~/.aws/credentials file.
$ vi ~/.aws/credentials
aws_access_key_id = ASIAYQXMDDN5CGUE****
aws_secret_access_key = qtQlqQONtbU2H6MNb2VJfqRpOALlVto8*****