Deploying AWX on AWS EKS

Deploying AWX (Ansible Tower) on Amazon Elastic Kubernetes Service (EKS) with an AWS account service is a powerful way to manage your Ansible automation workflows and securely integrate with AWS resources.

Deploying AWX on AWS EKS

Deploying AWX (Ansible Tower) on Amazon Elastic Kubernetes Service (EKS) with an AWS account service is a powerful way to manage your Ansible automation workflows and securely integrate with AWS resources.

In this tutorial, we will guide you through the process step by step.

Prerequisites:

  1. An AWS account with the necessary permissions to create an EKS cluster.
  2. AWS CLI and kubectl installed on your local machine.
  3. An IAM user with EKS cluster administrative permissions.
  4. eksctl tool installed for managing EKS clusters.
  5. Helm 3 installed on your local machine.
  6. Basic knowledge of AWS, Kubernetes, and Ansible.

Step 1: Create an EKS Cluster

In this step, we'll create an EKS cluster where AWX will be deployed.

eksctl create cluster \
    --name awx-cluster \
    --version 1.21 \
    --region <your-region> \
    --nodegroup-name standard-workers \
    --node-type t2.micro \
    --nodes 2 \
    --nodes-min 1 \
    --nodes-max 3

Replace <your-region> with your desired AWS region.

and then , configure kubectl to use the New Cluster :

aws eks --region <your-region> update-kubeconfig --name awx-cluster

Step 2: Install Helm and Deploy AWX

Add the AWX Helm repository:

helm repo add awx https://awx-helm-charts.s3.amazonaws.com/stable/

Create a values.yaml file with the necessary configurations. Customize this file according to your requirements.
Here's a minimal example

awx:
  ingress:
    enabled: true
    annotations:
      kubernetes.io/ingress.class: "nginx"
    path: /
    hosts:
      - awx.example.com
    tls:
      - secretName: awx-tls
        hosts:
          - awx.example.com


This example sets up an Ingress resource for AWX with a custom domain and TLS certificate. Replace awx.example.com with your domain and certificate details.

Install AWX using Helm:

helm install awx awx/awx -f values.yaml

Wait for the AWX pods to be in a running state:

kubectl get pods -n default -l "app.kubernetes.io/name=awx,app.kubernetes.io/instance=awx" --watch

Step 3: Access AWX

Once all the AWX pods are in a running state, you can access AWX's web interface using the domain you specified in the values.yaml file (awx.example.com in our example).

Then, let's retrieve the admin password:

helm uninstall awx
eksctl delete cluster --name awx-cluster --region <your-region>

Use the admin password to log in to AWX's web interface.

AWX Getting Started | Websoft9
AWX Login interface

Step 4: Configure AWX for AWS

  1. In AWX, navigate to the "Settings" section and select "Credentials."
  2. Create new credentials for AWS by specifying your AWS access key and secret key.
  3. Create AWS inventory and associate it with the AWS credentials.
  4. You can now use AWX to create playbooks and run Ansible jobs that interact with your AWS resources securely.

Step 5: Cleaning Up (Optional)

If you want to delete the EKS cluster and AWX deployment, you can use the following commands:

helm uninstall awx
eksctl delete cluster --name awx-cluster --region <your-region>

Remember that AWS resources, including EKS clusters, can incur costs, so it's a good practice to clean up when you're done with your infrastructure.

Conclusion

In this tutorial, you've learned how to deploy AWX on AWS EKS, configure it for AWS, and manage your Ansible automation workflows. This setup allows you to securely automate tasks and interact with AWS resources using Ansible playbooks and AWX.