In today’s digital world, businesses need to connect and manage external services securely and efficiently. One useful tool for this is Gloo Gateway from Solo.io, an API gateway that helps businesses integrate with external APIs easily.
When we talk about custom integration, we mean setting up these connections to work smoothly and securely with your business’s systems. A clear example of this in action is using AWS Signature Version 4 (Sigv4). Sigv4 is a method for securely adding authentication information to requests made to AWS services.
This guide will show you how the Gloo Gateway can handle Sigv4, making sure that your interactions with AWS services like S3 are secure and well-managed, which is essential for protecting your data and ensuring reliable service.
Why would I want to sign the request in the gateway?
Integrating AWS Signature Version 4 for accessing an S3 bucket directly through a gateway like Gloo Gateway offers several advantages, especially in terms of security, scalability, and architectural simplicity. Here’s a detailed breakdown of why it is beneficial:
- Enhanced security: Time-limited signatures (usually 15m), message integrity with hashed payloads, and scoped credentials managed by the gateway
- Centralized management: Reduced complexity and security risks as credentials are managed and rotated in a single location, and consistency as the gateway can enforce security policies across all requests
- Scalability and performance: Services behind the gateway don’t need to handle AWS-specific authentication, and the gateway can potentially cache signed requests speeding up the overall interactions
- Architectural cleanliness: Same policies across services regarding external systems like AWS
- Regulatory compliance: Access logs, monitoring, security practices, and everything else that is provided out of the box by an enterprise gateway
External Service Definition
First, we are going to define the external destination for the traffic.
Route Table Configuration
This part specifies how the requests should be routed within the Gloo Gateway. It has two routes: one for handling typical HTTP requests to internal services (/get and /headers paths) and another route (/cake.json), which is forwarded to the defined external service (S3 bucket).
External Authentication Policy
This policy configures authentication for routes that require external validation. It utilizes an external authentication server to validate requests and ensures that specific headers related to AWS authentication are appropriately handled.
It is composed of two steps, the authorization with an API key and then the signing of the request to be sent to AWS.
The apikeys can be easily created as Kubernetes secrets, and stored in a storage backend as redis as well:
Custom Code for the Integration
The custom code is developed in nodejs, and compiled in a oci image:
Now we are ready to send requests to our gateway endpoint and get responses from aws s3 bucket, just browsing:
Gloo Gateway Custom Integrations
AWS sigV4 is just one of the multiple possibilities that can be implemented and used in the gateway.
A custom integration can be easily implemented following these same steps, and developed in the language of your choice for practically any requirement. This could be anything from cloud storage services like AWS S3, to third-party APIs for payment processing, social media integrations, or data analytics platforms.
By abstracting the complexity of external integrations to a gateway layer, you create a centralized, secure, and scalable point of control that can adapt to various external APIs with minimal impact on your core application logic. Whether you’re integrating with one service or many, the gateway approach provides a robust framework for extending your application’s capabilities in a controlled and efficient manner.
Want to expand your API gateway knowledge? Discover more by reading our detailed buyer’s guide on API gateways.
This guide explores key features that make API gateways an essential tool for any modern application architecture. Whether you’re new to API gateways or looking to enhance your existing setups, you’ll gain valuable insights and tips. Dive deeper and enhance your expertise today!