Assigning an IAM role to the EC2 instance
When applications running on EC2 instances need to access other AWS resources, an application needs credentials, such as access key and secret access key. You can distribute access keys and secret access keys with applications to the EC2 instance, but that is not the best practice. IAM roles are designed in such a way that your applications can make API requests from your EC2 instances without requiring you to manage any security credentials that application needs. Instead, you can assign an IAM role to the EC2 instance that has permissions but does not have any long-term credentials. For example, you can use IAM roles to grant permissions to applications running on your EC2 instances that needs to use a bucket in Amazon S3. You can specify permissions for IAM roles by creating a policy in the JSON format. These are similar to the policies that you create for IAM users. If you make a change to a role, the change is propagated to all the instances...