Service Connectors
Managing authentication to cloud services and resources with Service Connectors
Service Connectors provide a unified way to handle authentication between ZenML and external services like cloud providers. They are a critical part of working with cloud-based stacks and significantly simplify the authentication challenge in ML workflows.
A service connector is an entity that:
Stores credentials and authentication configuration
Provides secure access to specific resources
Can be shared across multiple stack components
Manages permissions and access scopes
Automatically generates and refreshes short-lived access tokens
Think of service connectors as secure bridges between your ZenML stack components and external services that abstract away the complexity of different authentication methods across cloud providers.
Why Use Service Connectors?
The Authentication Challenge
ML workflows typically interact with multiple cloud services (storage, compute, model registries, etc.), creating complex credential management challenges. Without service connectors, you would need to:
Configure authentication separately for each stack component
Handle different authentication methods for each cloud service
Store and manage credentials manually in code or configuration files
Update credentials in multiple places when they change
Implement proper security practices across all credential usage
Spend engineering time on authentication rather than ML development
Service connectors solve these problems by providing a single point of authentication that can be reused across your stack components, decoupling credentials from code and configuration.
Key Benefits
Centralized Authentication: Manage all your cloud credentials in one place
Credential Reuse: Configure authentication once, use it with multiple components
Security: Implement security best practices with short-lived tokens, principle of least privilege, and reduced credential exposure
Authentication Abstraction: Eliminate credential handling code in pipeline components while supporting multiple auth methods
Resource Discovery: Easily find available resources on your cloud accounts
Simplified Rotation: Update credentials in one place when they change
Team Sharing: Securely share access to resources within your team
Multi-cloud Support: Use the same interface across AWS, GCP, Azure and other services with consistent patterns
Supported Cloud Providers and Services
ZenML supports connectors for major cloud providers and services:
AWS: For Amazon Web Services (S3, ECR, SageMaker, etc.)
GCP: For Google Cloud Platform (GCS, GCR, Vertex AI, etc.)
Azure: For Microsoft Azure (Blob Storage, ACR, AzureML, etc.)
Kubernetes: For Kubernetes clusters
Each connector type supports authentication methods specific to that service.
Working with Service Connectors
Creating and Managing Connectors
Service connectors can be created with different authentication methods depending on your cloud provider and security requirements.
Here is an example of how to register a new connector:
The authentication happens transparently to your ML code. You don't need to handle credentials in your pipeline steps - the service connector takes care of that for you.
Discovering Resources
A powerful feature of service connectors is resource discovery:
This helps you find existing resources when configuring stack components.
Using Connectors with Stack Components
Connect components to services:
Best Practices
Use descriptive names for connectors indicating their purpose or environment
Create separate connectors for development, staging, and production environments
Apply least privilege when configuring connector permissions and resource scopes
Regularly rotate credentials for enhanced security
Document your connector configurations for team knowledge sharing
Leverage short-lived tokens where possible instead of long-lived credentials
Avoid hard-coding credentials in your code and config files, use service connectors instead
Code Example
When using service connectors, your pipeline code remains clean and focused on ML logic:
Next Steps
Last updated
Was this helpful?