jenkinscontinuous-integrationaws-cli

Jenkins: Execute AWS CLI command inside a pipeline Jenkins file


Do you know how to execute AWS CLI command inside a Jenkinsfile in order to build a pipeline? I didn't find any plugins


Solution

  • First you need install aws cli on your server and make sure the jenkins user has permissions to run it.

    Or simply use the Amazon AMI when creating the EC2 instance, it comes with the aws cli.

    Assign a role the instance with the appropriate policy. ( it is simpler that using user key in aws configure )

    Within your pipeline steps use sh 'aws ...'