AWS Builder Center

Build a Custom SRE Agent Using AWS DevOps Agent

Creating an Amazon EKS cluster, connecting it to the AWS DevOps Agent, and verifying that the agent can successfully investigate issues within the EKS cluster.

Series: AIOps (1 article)

  1. 1
    Build a Custom SRE Agent Using AWS DevOps Agent This article
DevOps Engineer | Master of IT

Step 1 - Install the required tools and log in to AWS using the AWS CLI.

Check your tools: Run these commands
aws --version
kubectl version --client
docker --version

AWS CLI: Configure and verify your identity and region.
# AWS Login
aws configure

# Verify AWS identity and Region
aws sts get-caller-identity
aws configure get region


Step 2 - Create an EKS cluster

Follow these settings
  1. Open Amazon EKS and choose Create cluster.
  1. Give it the name  devops-agent-demo .
  1. Choose a supported Kubernetes version offered by the console.
  1. Create or select a cluster IAM role with the required EKS cluster permissions.
  1. Select the default VPC or a dedicated test VPC with suitable subnets.
  1. Enable the EKS API authentication mode, or a mode that includes the EKS API.
  1. Create the cluster and wait until its status is  Active .
  1. Add a small managed node group for the sample application.
For the node group, choose a small general-purpose instance type that is available in your selected Availability Zones. One small node is sufficient for a basic demonstration, although it provides no high availability.

Keep the environment private where practical. If you enable a public Kubernetes API endpoint for your own administration, restrict its allowed CIDR ranges to your current public IP rather than allowing access from everywhere.



Step 3 - Deploy a sample application

Connect kubectl to EKS
# Update Kubeconfig
aws eks update-kubeconfig \
--region us-east-1 \
--name devops-agent-demo
# Check the connection
kubectl get nodes
kubectl get namespaces
kubectl get pods -A

Deploy a simple NGINX web application.
nginx.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: demo-web
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: demo-web
template:
metadata:
labels:
app: demo-web
spec:
containers:
- name: nginx
image: nginx:1.28
ports:
- containerPort: 80
resources:
requests:
cpu: 100m
memory: 64Mi
limits:
cpu: 250m
memory: 128Mi
---
apiVersion: v1
kind: Service
metadata:
name: demo-web
namespace: default
spec:
selector:
app: demo-web
ports:
- port: 80
targetPort: 80
type: ClusterIP

Apply nginx.yaml
# Apply manifest file
kubectl apply -f app.yaml

# Check rollout status
kubectl rollout status deployment/demo-web

# List all
kubectl get deployment,svc,pods


Test the application locally through port forwarding
kubectl port-forward svc/demo-web 8080:80



Step 4 - Set up AWS DevOps Agent Space

Open the AWS DevOps Agent console
  • Create an Agent Space named eks-sre-agent-demo.
  • Select us-east-1 as the Agent Space Region.
  • Associate your AWS account as the monitoring account.
  • Complete the required IAM role and account association setup.
  • Open the Operator Web App and verify that the Agent Space is ready.



Grant EKS access
In the EKS console, open devops-agent-demo and select Access.
  1. Confirm the cluster authentication mode includes the EKS API.
  1. Create an access entry for the IAM role shown in the Agent Space's cloud source configuration.
  1. Attach the AWS-managed  AmazonAIOpsAssistantPolicy  access policy.
  1. Scope the policy to the cluster, or to the specific namespaces needed for the demo.
  1. Save the access entry.



Step 5 - Verify the agent can investigate EKS

Open the Operator Web App and start a new investigation. Use this initial prompt.



Compare the result with your own terminal output

kubectl get pods -n default
kubectl describe deployment demo-web
kubectl get events -n default --sort-by=.metadata.creationTimestamp



Thanks for reading the Article.

Series: AIOps (1 article)

  1. 1
    Build a Custom SRE Agent Using AWS DevOps Agent This article
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article