GCP Memorystore IAM 인증
GCP Memorystore IAM 인증 (GCP Memorystore IAM Authentication)
LiteLLM의 Redis 캐시를 IAM 인증으로 GCP Memorystore에 연결해요. 그러면 프록시가 서비스 계정으로 인증하고 콘피그에 Redis 비밀번호가 존재하지 않아요.
출처: 문서
본문
info
Redis용 GCP IAM 인증은 현재 Redis 클러스터에서만 지원돼요. AWS ElastiCache와 Valkey는 AWS ElastiCache IAM Authentication을, Azure Cache for Redis와 Azure Managed Redis는 Azure Redis Entra ID Authentication을 보세요.
uv add google-cloud-iam
config.yaml에 설정하기:
Redis Cluster with GCP IAM:
litellm_settings:
cache: True
cache_params:
type: redis
redis_startup_nodes:
[{ "host": "10.128.0.2", "port": 6379 }, { "host": "10.128.0.2", "port": 11008 }]
gcp_service_account: "projects/-/serviceAccounts/[email protected]"
ssl: true
ssl_cert_reqs: null
ssl_check_hostname: false
.env에 설정하기:
Redis Cluster:
REDIS_CLUSTER_NODES='[{"host": "10.128.0.2", "port": 6379}, {"host": "10.128.0.2", "port": 11008}]'
REDIS_GCP_SERVICE_ACCOUNT="projects/-/serviceAccounts/[email protected]"
REDIS_GCP_SSL_CA_CERTS="./server-ca.pem"
REDIS_SSL="True"
REDIS_SSL_CERT_REQS="None"
REDIS_SSL_CHECK_HOSTNAME="False"
GCP 인증 설정 (GCP Authentication Setup)
GCP 자격 증명이 구성되어 있는지 확인하세요:
# Option 1: Service account key file
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/service-account-key.json"
# Option 2: If running on GCP compute instance with service account attached
# No additional setup needed
프록시가 실행되면 /cache/ping으로 연결을 확인하세요. Redis 캐시의 나머지 모든 것(클러스터 토폴로지와 TLS 포함)은 Redis and Valkey를 보세요.