...

/

Demo: Attaching a Read-Only Policy to an EC2 Instance

Demo: Attaching a Read-Only Policy to an EC2 Instance

Learn how to create an S3 read-only policy and attach it to an EC2 instance.

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.

Press + to interact
AWS CodeDeploy dependency architecture
AWS CodeDeploy dependency architecture

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. ...