integrate Jenkins with AWS CodeCommit

0 votes

I'm trying to integrate Jenkins with AWS CodeCommit. My jenkins is running on an ec2 instance with ubuntu 14.04. 

The problem is, that sudo -u jenkins aws configure isn't executed because the jenkins user has no permissions.

What would you do?

Apr 16, 2019 in Jenkins by Vishal
3,345 views

2 answers to this question.

+1 vote

Hey @Vishal, Follow these steps:

  1. Create an ssh key on the Jenkins EC2 instance (/var/lib/jenkins/.ssh/id_rsa)

    ssh-keygen -b 2048 -t rsa -f /var/lib/jenkins/.ssh/id-rsa -a -N
    
  2. Upload the public key to an IAM user (IAM user must have CodeCommit access)

    aws iam upload-ssh-public-key --user-name <username> --ssh-public-key-body file:///var/lib/jenkins/.ssh/id_rsa.pub
    
  3. Collect the SSHPublicKeyID when you upload the key

    {
     "SSHPublicKey": {
     "UserName": "jenkins",
     "Status": "Active",
     "SSHPublicKeyBody": "ssh-rsa <rsa-key> <host>\n",
     "UploadDate": "2015-09-02T19:18:24.309Z",
     "Fingerprint": "xxx",
     "SSHPublicKeyId": "******"
     }
    }
    
  4. Create/modify SSH config file

    Host git-codecommit.*.amazonaws.com
      User APK*******
      IdentityFile /var/lib/jenkins/.ssh/id_rsa
      StrictHostKeyChecking no
    
  5. Where the ****** is the value of the Key ID retrieved in step 3

  6. Copy or move this file to /var/lib/jenkins/.ssh/config (or wherever Jenkins is installed on your EC2 instance)
  7. Ensure jenkins' user has 0600 permissions to /var/lib/jenkins/.ssh directory
  8. Create a Jenkins job as described in the blog post you first used. For the repository URL, however, enter the SSH url instead.
answered Apr 16, 2019 by Pooja
+1 vote
jenkins user add in visudo or /etc/sudoers
answered May 14, 2019 by anonymous
Is that all?
Yea this answer makes sense...Giving root priviliges to the user...

Related Questions In Jenkins

0 votes
0 answers

integrate Jenkins with AWS CodeCommit

I'm trying to integrate Jenkins with AWS ...READ MORE

Apr 16, 2019 in Jenkins by Vishal

closed May 14, 2019 by Vardhan 1,475 views
0 votes
1 answer

any way to integrate Jenkins with ServiceNow?

Now, there is no official servicenow support ...READ MORE

answered Apr 10, 2018 in Jenkins by DareDev
• 6,890 points
4,295 views
0 votes
1 answer

Unable to integrate jenkins with tfs: EndpointNotFoundException

Check if you can connect to tfs ...READ MORE

answered May 28, 2018 in Jenkins by DareDev
• 6,890 points

edited May 28, 2018 by DareDev 994 views
0 votes
2 answers

How could I integrate Selenium with Jenkins?

Hey @Ali, follow these steps to integrate ...READ MORE

answered Dec 20, 2018 in Jenkins by Eric
1,158 views
+2 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 58,090 points
2,436 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
3,460 views
0 votes
1 answer

Use a docker image with jenkins declarative pipeline

Hey @Jithin, you could use something like ...READ MORE

answered Apr 12, 2019 in Jenkins by Bishu
4,654 views
0 votes
1 answer

Use Custom Docker registry with jenkins declarative pipeline

Yes, you can! try something like this: node ...READ MORE

answered Apr 12, 2019 in Jenkins by Bishu
2,128 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP