用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/firstbatchxyz/kai --skill aws-cli命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Inspect and analyze codebases using pygount for LOC counting, language breakdown, and code-vs-comment ratios. Use when asked to check lines of code, repo size, language composition, or codebase stats.
Set up GitHub authentication for the agent using git (universally available) or the gh CLI. Covers HTTPS tokens, SSH keys, credential helpers, and gh auth — with a detection flow to pick the right method automatically.
Production-grade PR review with execution-verified suggestions. Reads repository conventions, history, and security surfaces before reviewing. For every suggested fix, attempts to compile and test it in the sandbox — the comment includes proof. Modelled on GitHub Copilot's agentic architecture with one critical advantage: the sandbox is already running.
基于 SOC 职业分类
正在显示 SKILL.md
| name | aws-cli |
| description | Manage AWS services for ML workflows including S3, ECR, SageMaker, and EC2 |
| version | 1.0.0 |
| author | kai-agent |
| metadata | {"kai":{"tags":["kai","compute","aws","s3","ecr","sagemaker","ec2","ml","inference"]}} |
Skill for managing AWS services commonly used in ML and inference workflows: S3 for storage, ECR for container images, SageMaker for managed inference, and EC2 for GPU instances.
This skill uses the following environment variables:
AWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEYAWS_DEFAULT_REGION (e.g., us-east-1)If they are not set, ask your admin to add them in Agent Settings.
Optionally, AWS_SESSION_TOKEN is used for temporary credentials (STS/SSO).
# AWS CLI v2
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip && sudo ./aws/install
# Python SDK
pip install boto3
# Upload a directory
aws s3 sync ./model-weights/ s3://your-bucket/models/llama-3.1-8b-awq/
# Upload a single file
aws s3 cp ./benchmark_results.json s3://your-bucket/results/benchmark_results.json
# Download a directory
aws s3 sync s3://your-bucket/models/llama-3.1-8b-awq/ ./model-weights/
# Download a single file
aws s3 cp s3://your-bucket/datasets/calibration.jsonl ./calibration.jsonl
aws s3 ls s3://your-bucket/models/ --recursive --human-readable
import boto3
s3 = boto3.client("s3")
# Automatic multipart upload for large files
from boto3.s3.transfer import TransferConfig
config = TransferConfig(
multipart_threshold=1024 * 1024 * 100, # 100 MB
max_concurrency=10,
multipart_chunksize=1024 * 1024 * 100,
)
s3.upload_file(
"./model.safetensors",
"your-bucket",
"models/llama-3.1-8b/model.safetensors",
Config=config,
)
aws s3 presign s3://your-bucket/models/llama-3.1-8b-awq/model.safetensors --expires-in 3600
url = s3.generate_presigned_url(
"get_object",
Params={"Bucket": "your-bucket", "Key": "models/model.safetensors"},
ExpiresIn=3600,
)
# Delete objects older than 30 days in the tmp/ prefix
aws s3api put-bucket-lifecycle-configuration \
--bucket your-bucket \
--lifecycle-configuration '{
"Rules": [{
"ID": "cleanup-tmp",
"Prefix": "tmp/",
"Status": "Enabled",
"Expiration": {"Days": 30}
}]
}'
aws ecr create-repository --repository-name inference-server --region us-east-1
# Authenticate Docker to ECR
aws ecr get-login-password --region us-east-1 | \
docker login --username AWS --password-stdin <account-id>.dkr.ecr.us-east-1.amazonaws.com
# Build
docker build -t inference-server:latest .
# Tag
docker tag inference-server:latest \
<account-id>.dkr.ecr.us-east-1.amazonaws.com/inference-server:latest
# Push
docker push <account-id>.dkr.ecr.us-east-1.amazonaws.com/inference-server:latest
aws ecr list-images --repository-name inference-server
docker pull <account-id>.dkr.ecr.us-east-1.amazonaws.com/inference-server:latest
import boto3
sagemaker = boto3.client("sagemaker")
# Create model
sagemaker.create_model(
ModelName="llama3-8b-vllm",
PrimaryContainer={
"Image": "<account-id>.dkr.ecr.us-east-1.amazonaws.com/inference-server:latest",
"ModelDataUrl": "s3://your-bucket/models/llama-3.1-8b-awq/model.tar.gz",
"Environment": {
"MODEL_NAME": "meta-llama/Llama-3.1-8B-Instruct",
"QUANTIZATION": "awq",
},
},
ExecutionRoleArn="arn:aws:iam::<account-id>:role/SageMakerRole",
)
# Create endpoint config
sagemaker.create_endpoint_config(
EndpointConfigName="llama3-8b-config",
ProductionVariants=[{
"VariantName": "primary",
"ModelName": "llama3-8b-vllm",
"InstanceType": "ml.g5.2xlarge",
"InitialInstanceCount": 1,
}],
)
# Create endpoint
sagemaker.create_endpoint(
EndpointName="llama3-8b-endpoint",
EndpointConfigName="llama3-8b-config",
)
runtime = boto3.client("sagemaker-runtime")
response = runtime.invoke_endpoint(
EndpointName="llama3-8b-endpoint",
ContentType="application/json",
Body='{"prompt": "Explain batching:", "max_tokens": 256}',
)
print(response["Body"].read().decode())
aws sagemaker list-endpoints --status-equals InService
aws sagemaker delete-endpoint --endpoint-name llama3-8b-endpoint
aws sagemaker delete-endpoint-config --endpoint-config-name llama3-8b-config
aws sagemaker delete-model --model-name llama3-8b-vllm
| Instance | GPU | VRAM | Use case |
|---|---|---|---|
| ml.g5.xlarge | 1x A10G | 24 GB | Quantized models up to 13B |
| ml.g5.2xlarge | 1x A10G | 24 GB | Same GPU, more CPU/RAM |
| ml.g5.12xlarge | 4x A10G | 96 GB | Multi-GPU, 70B quantized |
| ml.p4d.24xlarge | 8x A100 (40 GB) | 320 GB | Large models, high throughput |
| ml.p5.48xlarge | 8x H100 (80 GB) | 640 GB | Maximum performance |
aws ec2 run-instances \
--image-id ami-0abcdef1234567890 \
--instance-type g5.xlarge \
--key-name your-key \
--security-group-ids sg-xxxxx \
--subnet-id subnet-xxxxx \
--block-device-mappings '[{"DeviceName":"/dev/sda1","Ebs":{"VolumeSize":200}}]' \
--tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=inference-dev}]'
aws ec2 describe-instances \
--filters "Name=instance-type,Values=g5.*,p4d.*,p5.*" \
"Name=instance-state-name,Values=running" \
--query 'Reservations[*].Instances[*].[InstanceId,InstanceType,LaunchTime,PublicIpAddress]' \
--output table
aws ec2 stop-instances --instance-ids i-xxxxx
aws ec2 start-instances --instance-ids i-xxxxx
aws ec2 terminate-instances --instance-ids i-xxxxx
| Instance | GPU | VRAM | On-demand $/hr (approx) |
|---|---|---|---|
| g5.xlarge | 1x A10G | 24 GB | $1.01 |
| g5.12xlarge | 4x A10G | 96 GB | $5.67 |
| g6.xlarge | 1x L4 | 24 GB | $0.80 |
| p4d.24xlarge | 8x A100 (40 GB) | 320 GB | $32.77 |
| p5.48xlarge | 8x H100 (80 GB) | 640 GB | $98.32 |
aws ec2 run-instances \
--instance-type g5.xlarge \
--instance-market-options '{"MarketType":"spot","SpotOptions":{"MaxPrice":"0.50"}}' \
--image-id ami-0abcdef1234567890 \
--key-name your-key
Spot instances cost 60-90% less but can be interrupted. Good for benchmarking and batch inference, not production serving.
import boto3
sts = boto3.client("sts")
identity = sts.get_caller_identity()
print(f"Account: {identity['Account']}, User: {identity['Arn']}")
s3 = boto3.client("s3")
buckets = s3.list_buckets()
for b in buckets["Buckets"]:
print(b["Name"])
models/llama3-8b/v2/model.safetensors).InvocationsPerInstance to handle traffic spikes.