Demo: Attaching a Read-Only Policy to an EC2 Instance
Explore how to create an IAM role with a read-only policy and attach it to an EC2 instance using AWS CLI. Learn the steps for managing instance profiles and associating them with EC2 for secure application deployment with AWS CodeDeploy.
We'll cover the following...
Let’s see how to deploy an application using AWS CodeDeploy. The diagram below shows that the EC2 instance needs an IAM role to read contents from S3 buckets. So, before deploying the application, let’s create this role using AWS CLI and assign it to our EC2 instance.
Create a role with no policies
Our first step is to create a role using the create-role CLI command. When we first create a role, it will not have any policies. We'll later associate a policy with this role. This CLI command accepts two arguments:
role-name: The name of the role to be created. ...