Create an IAM Policy for the Gitlab Runner.

In order to be able to deploy our website to an S3 bucket we need to allow our runner to access S3. We do that with an EC2 Instance policy that we attach to our Gitlab Instance.

  • In the AWS Console we select from the upper bar “Services” - > “IAM”

  • In the IAM Page we select “Roles” From the left side then “Create Role”. iam-1

  • In the Create Role Page, Select EC2 to create an instance profile, then click “Next” iam-2

  • In the Attach Permissions Polices Page use the search bar to look for “AmazonS3FullAccess” Policy, Then Click “Next” iam-3

  • On the Tags page, add any optional tags you might want, then click “Next” iam-4

  • In the review page, enter a name for the policy and a description. then click “Create Role” iam-5

Next, we will attach our new Role to the EC2 machine that runs Gitlab.