Create IAM role

Generate IAM user and access key

  1. Go to IAM service administration interface
  • Click Roles.

Role

  1. Click Create role

Role

  1. In the **Choose a use case ** section, we click on EC2 to create an IAM role to use for the application running inside EC2.
  • Click Next:Permissions

Role

  1. In the Filter policies box, enter S3.
  • Click AmazonS3FullAccess, we will grant full access to access and upload files to the S3 bucket we created.
  • Click Next: Tags.

Role

  1. Click Next: Review.

  2. Set Role name to ec2roles3upload

  • Click Create role.

Role

Next, we will use this role to assign to the EC2 instance and make it possible for our application to upload files to S3 without using the access key and secret access key in the code.