Create EC2 Instance Profile

Create instance profile

  1. We will create IAM instance profile for Amazon EC2 instance

    • Access to IAM
    • Select Policies
    • Select Create policy

IAM user

  1. In the step of creating policy, enter the content policy
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "EC2S3AccessForCodeDeploy",
            "Effect": "Allow",
            "Action": [
                "s3:Get*",
                "s3:List*"
            ],
            "Resource": [
                "arn:aws:s3:::[YOUR_S3_BUCKET_NAME]",
                "arn:aws:s3:::[YOUR_S3_BUCKET_NAME]/*"
            ]
        }
    ]
}

IAM user

  1. For Policy name: EC2S3AccessForCodeDeploy. Click Create policy

IAM user

Create EC2 Instance Profile

  1. Access to IAM. Select Roles > Create role IAM user

  2. For Select trusted entity:

  • Trusted entity type: select AWS service.
  • Use case: select EC2. Click Next IAM user
  1. For Add permissions: select the policy EC2S3AccessForCodeDeploy

If you don’t see your policy in the list, make sure you’re looking for customer-managed policies, or enter the policy name exactly into the search bar.

IAM user

  1. For Role name: EC2InstanceProfileRole. Click Create role IAM user IAM user

  2. Complete role creation.

IAM user