Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/yaml-lint-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ jobs:
run: pip install yamllint

- name: Lint YAML files
run: yamllint --format github .
run: yamllint --format github -d "{extends: default, ignore: ['*chart*']}" .
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## UNRELEASED

### **Added**
- added `eks-strands-agents-demo` manifest
- added `enable_docker_access` to `sagemaker-studio` module
- added `idle_timeout_in_minutes` to `sagemaker-studio` module
- added `max_idle_timeout_in_minutes` to `sagemaker-studio` module
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ End-to-end example use-cases built using modules in this repository.
| [Ray on Amazon Elastic Kubernetes Service (EKS)](manifests/ray-on-eks/) | Run Ray on AWS EKS. Deploys an AWS EKS cluster, KubeRay Ray Operator, and a Ray Cluster with autoscaling enabled. |
| [Fine-tune 6B LLM (GPT-J) using Ray on Amazon EKS](manifests/fine-tuning-6b/) | Run fine-tuning of 6B GPT-J LLM. Deploys an AWS EKS cluster, KubeRay Ray Operator, and a Ray Cluster with autoscaling enabled, and runs a fine-tuning job. [How to fine tune a 6B LLM simply and cost-effective using Ray on Amazon EKS?](https://medium.com/@junjie-tang/how-to-fine-tune-a-6b-llm-simply-and-cost-effective-using-ray-ai-runtime-on-amazon-eks-a4ae0b3c6464) |
| [DeepSeek R1 on Amazon SageMaker](manifests/deepseek-sagemaker/) | An example using [DeepSeek R1 Distill Llama 8B](https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Llama-8B) on Amazon SageMaker. Deploys a VPC, and Amazon SageMaker endpoint and Amazon SageMaker Studio IDE. |
| [Deploy a Weather Agent with Strands and Amazon EKS Auto Mode](manifests/eks-strands-agents-demo/) | An example using [Strands](https://strandsagents.com/latest/) agent on [Amazon EKS Auto Mode](https://aws.amazon.com/eks/auto-mode/). |
| [Mlflow tracking server and model registry with Amazon SageMaker](manifests/mlflow-tracking/) | An example using Mlflow experiments tracking, model registry, and LLM tracing with Amazon SageMaker. Deploy self-hosted Mlflow tracking server and model registry on AWS Fargate, and Amazon SageMaker Studio Domain environment. |
| [Managed Workflows with Apache Airflow (MWAA) for Machine Learning Training](manifests/mwaa-ml-training/) | An example orchestrating ML training jobs with Managed Workflows for Apache Airflow (MWAA). Deploys MWAA and an example ML training DAG. |
| [MLOps with Step Functions](manifests/mlops-stepfunctions/) | Automate machine learning lifecycle using Amazon SageMaker and AWS Step Functions. |
Expand Down Expand Up @@ -70,6 +71,12 @@ End-to-end example use-cases built using modules in this repository.
| [Amazon Bedrock Finetuning Module](modules/fmops/bedrock-finetuning/README.md) | Creates a pipeline that automatically triggers Amazon Bedrock Finetuning. |
| [AppSync Knowledge Base Ingestion and Question and Answering RAG Module](modules/fmops/qna-rag/README.md) | Creates an Graphql endpoint for ingestion of data and and use ingested as knowledge base for a Question and Answering model using RAG. |

### Agent Modules

| Type | Description |
|--------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------|
| [Strands Agent on Amazon EKS Auto Mode](modules/agents/eks-strands-agents-demo/README.md) | Creates an Amazon EKS Auto Mode cluster and deploys an example Strands Weather Agent. |

### MWAA Modules

| Type | Description |
Expand Down
63 changes: 63 additions & 0 deletions manifests/eks-strands-agents-demo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Deploy demo Weather Agent with Strands and Amazon EKS Auto Mode

## Description

This manifest deploys a demo [Strands](https://strandsagents.com/latest/) Weather Agent on [Amazon EKS Auto Mode](https://aws.amazon.com/eks/auto-mode/).

1. Provision an Amazon EKS Auto Mode Cluster
2. Build Weather Agent Docker image and push into Amazon ECR repository
3. Create and associate Amazon EKS service account permissions to an IAM Role with Amazon Bedrock access
4. Deploy Weather Agent to Amazon EKS using Helm

## Deployment

```
seedfarmer apply manifests/eks-strands-agents-demo/deployment.yaml
```

For full deployment instructions, please refer to [DEPLOYMENT.MD](https://github.com/awslabs/aiops-modules/blob/main/DEPLOYMENT.md).

## User Guide

### Call the Agent

1. Connect to the cluster

```
aws eks update-kubeconfig --name $CLUSTER_NAME
```

2. Port-forward agent service

```
kubectl --namespace default port-forward service/strands-agents-weather 8080:80 &
```
3. Call agent service

```
curl -X POST \
http://localhost:8080/weather \
-H 'Content-Type: application/json' \
-d '{"prompt": "What is the weather in Seattle?"}'
```
```
# Weather in Seattle, Washington

## Current Conditions
**This Afternoon:** Sunny with a high near 73°F. Northwest wind around 6 mph. Precipitation chance: 1%.

## Tonight
**Tonight:** Mostly clear with a low around 54°F. North northeast wind around 6 mph. No precipitation expected.

## Extended Forecast
- **Sunday:** Sunny with a high near 78°F. North northeast wind 3 to 10 mph. No precipitation expected.
- **Sunday Night:** Mostly clear with a low around 58°F.
- **Monday:** Sunny with a high near 82°F. North wind 3 to 9 mph.
- **Monday Night:** Mostly clear with a low around 59°F.
- **Tuesday:** Sunny with a high near 81°F.

## Outlook
The weather in Seattle looks very pleasant for the next several days with sunny skies and comfortable temperatures. Daytime highs will be in the 70s to low 80s, with overnight lows in the mid-to-upper 50s. There is virtually no chance of precipitation through the next few days, making for excellent outdoor conditions.

For Independence Day (July 4th), you can expect sunny conditions with a high near 75°F, perfect for outdoor celebrations and fireworks viewing.
```
5 changes: 5 additions & 0 deletions manifests/eks-strands-agents-demo/core-modules.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name: eks
path: modules/agents/eks-strands-agents-demo
parameters:
- name: EksClusterName
value: eks-strands-agents-demo
15 changes: 15 additions & 0 deletions manifests/eks-strands-agents-demo/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: eks-strands-agents-demo
toolchainRegion: us-east-1
groups:
- name: core
path: manifests/eks-strands-agents-demo/core-modules.yaml
targetAccountMappings:
- alias: primary
accountId:
valueFrom:
envVariable: PRIMARY_ACCOUNT
default: true
codebuildImage: public.ecr.aws/codebuild/amazonlinux2-x86_64-standard:5.0
regionMappings:
- region: us-west-2
default: true
12 changes: 6 additions & 6 deletions manifests/mwaa-ml-training/mwaa-dag-modules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ parameters:
group: mwaa
name: mwaa
key: MwaaExecRoleArn
# - name: bucket-policy-arn
# valueFrom:
# moduleMetadata:
# group: optionals
# name: datalake-buckets
# key: FullAccessPolicyArn
# - name: bucket-policy-arn
# valueFrom:
# moduleMetadata:
# group: optionals
# name: datalake-buckets
# key: FullAccessPolicyArn
26 changes: 26 additions & 0 deletions modules/agents/eks-strands-agents-demo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Introduction

## Description

This module runs a demo [Strands](https://strandsagents.com/latest/) Weather Agent on [Amazon EKS Auto Mode](https://aws.amazon.com/eks/auto-mode/).

The module will:
1. Provision an Amazon EKS Auto Mode Cluster
2. Build Weather Agent Docker image and push into Amazon ECR repository
3. Create and associate Amazon EKS service account permissions to an IAM Role with Amazon Bedrock access
4. Deploy Weather Agent to Amazon EKS using a Helm chart

### Required Parameters

- `eks-cluster-name`: Amazon EKS Cluster name
- `ecr-repo-name`: Amazon ECR Repository name

### Sample manifest declaration

```yaml
name: weather-agent
path: modules/agents/eks-strands-agents-demo
parameters:
- name: EksClusterName
value: eks-strands-agents-demo
```
13 changes: 13 additions & 0 deletions modules/agents/eks-strands-agents-demo/bedrock-policy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"bedrock:InvokeModel",
"bedrock:InvokeModelWithResponseStream"
],
"Resource": "*"
}
]
}
23 changes: 23 additions & 0 deletions modules/agents/eks-strands-agents-demo/chart/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
6 changes: 6 additions & 0 deletions modules/agents/eks-strands-agents-demo/chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v2
name: strands-agents-weather
description: A Helm chart for deploying strands-agents-weather application
type: application
version: 0.1.0
appVersion: "1.0.0"
28 changes: 28 additions & 0 deletions modules/agents/eks-strands-agents-demo/chart/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- if .Values.ingress.hosts }}
{{- range $host := .Values.ingress.hosts }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host }}{{ $.Values.ingress.path }}
{{- end }}
{{- else }}
export ALB_URL=$(kubectl get ingress strands-agents-weather -o jsonpath='{.status.loadBalancer.ingress[0].hostname}')
echo "The shared ALB is available at: http://$ALB_URL"

NOTE: It may take a few minutes for the LoadBalancer to be active, you can wait for it by running
aws elbv2 wait load-balancer-available --load-balancer-arns $(aws elbv2 describe-load-balancers --query 'LoadBalancers[?DNSName==`'"$ALB_URL"'`].LoadBalancerArn' --output text)
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "strands-agents-weather.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "strands-agents-weather.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "strands-agents-weather.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export SVC_NAME=$(kubectl get svc --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "strands-agents-weather.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export SVC_PORT=$(kubectl get svc --namespace {{ .Release.Namespace }} $SVC_NAME -o jsonpath="{.spec.ports[0].port}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward service/$SVC_NAME 8080:$SVC_PORT
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "strands-agents-weather.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "strands-agents-weather.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "strands-agents-weather.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "strands-agents-weather.labels" -}}
helm.sh/chart: {{ include "strands-agents-weather.chart" . }}
{{ include "strands-agents-weather.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "strands-agents-weather.selectorLabels" -}}
app.kubernetes.io/name: {{ include "strands-agents-weather.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "strands-agents-weather.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "strands-agents-weather.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "strands-agents-weather.fullname" . }}
labels:
{{- include "strands-agents-weather.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "strands-agents-weather.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "strands-agents-weather.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "strands-agents-weather.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.env }}
env:
{{- toYaml .Values.env | nindent 12 }}
{{- end }}
ports:
- name: http
containerPort: {{ .Values.service.targetPort }}
protocol: TCP
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.topologySpreadConstraints }}
topologySpreadConstraints:
{{- toYaml . | nindent 8 }}
{{- end }}
Loading