1.launch a new EC2 instance or use an existing one.
2. Choose the server name, operating system (OS), instance type, VPC, key pair, and storage configuration.
3.After connecting to the server, list all S3 buckets using the following command:
# aws s3 ls
4.Open the IAM console, navigate to the Roles section, click on ‘Create Role’, select the entity type, and specify the use case.
After clicking the ‘Next’ button, select the appropriate permissions. Then, proceed to the next step, provide a role name, add tags, and click ‘Next’ again
5.In the EC2 console, select the server, go to ‘Actions’, then ‘Security’, and choose ‘Modify IAM Role’.
6.After clicking on the ‘Modify’ section, select the IAM role, choose the desired role, and then click ‘Update Role’.
7.Once the process is complete, verify that the role has been successfully attached.
8.After connecting to the server, try listing the buckets
END