GitLab Runner needs sudo privileges to execute CI/CD tasks such as build, test, and deploy. This section will guide you through configuring sudo permissions for GitLab Runner.
Execute the command:
sudo visudo
Add the following line to the file:
gitlab-runner ALL=(ALL) NOPASSWD:ALL
After adding, press Ctrl + X
to exit, Y
to confirm saving, and Enter
to complete.
Steps to follow:
Verify that the CustomRWECRRole
IAM Role is assigned to the EC2.
Navigate in IAM Console:
CustomRWECRRole
Add new permissions:
AmazonEC2FullAccess
CustomRWECRRole
Assigning AmazonEC2FullAccess
should be carefully considered in a production environment. Follow the principle of least privilege and only grant necessary permissions.