How do I run AWS EKS jobs on self-hosted runners with Azure Pipelines?

AWS EKS (Elastic Kubernetes Service) jobs can be efficiently run using self-hosted runners in Azure Pipelines. Here’s a step-by-step guideline on how to set this up.

AWS EKS, Azure Pipelines, self-hosted runners, Kubernetes jobs, CI/CD integration

This guide provides insights into integrating AWS EKS jobs with self-hosted runners in Azure Pipelines, optimizing DevOps workflows.

    # Sample Azure Pipelines YAML to run AWS EKS jobs on self-hosted runners
    pool:
      name: 'Self-Hosted'
      demands:
        - azureSubscription  # Add your Azure subscription here  

    variables:
      awsRegion: 'us-west-2'  # Specify your AWS region
      kubernetesNamespace: 'default'  # Define the Kubernetes namespace

    jobs:
    - job: RunEKSJob
      displayName: 'Run Job on AWS EKS'
      steps:
      - task: AWSCLI@1
        inputs:
          awsCredentials: 'myAWSServiceConnection'  # Use your AWS service connection
          regionName: '$(awsRegion)'
          command: 'eks'
          scriptType: 'inline'
          inlineScript: |
            echo "Running job on AWS EKS..."
            aws eks --region $(awsRegion) update-kubeconfig --name MyCluster
            kubectl apply -f job_definition.yml --namespace=$(kubernetesNamespace)
    

AWS EKS Azure Pipelines self-hosted runners Kubernetes jobs CI/CD integration