News How KrakenD Solves API Gateway Security Vulnerabilities

Step-by-step Migration Guide: From AWS API Gateway to KrakenD API Gateway

by Albert Garcia

KrakenD Compass

Introduction

As you consider migrating from AWS API Gateway to KrakenD API Gateway, you’re likely driven by a number of compelling benefits such as a better pricing model, reduced vendor lock-in, operational simplicity, enhanced content manipulation and transformation capabilities, increased connectivity protocols, and extensibility trough Custom golang Plugins or Lua scripts. This guide will walk you through the primary steps and considerations in this migration process.

Pre-Migration

Before starting the migration process, it’s essential to make sure to map your existing API Gateway resources to equivalent KrakenD concepts, which include endpoints, routers, and backends.

Additionally, perform an inventory of your existing AWS APIs and identify any dependencies or integrations that may need to be updated during the migration. For example, if your current setup relies on AWS integrations like Lambda, you will want to ensure that these are effectively connected to your KrakenD setup.

Migration Steps

Step 1: Export API Gateway Definition using OpenAPI

AWS API Gateway supports exporting the existing API definitions using OpenAPI. Follow the instructions provided by AWS to export your current API definitions. Save the OpenAPI specification file as this will be used in the next step.

Step 2: Import OpenAPI Specification to KrakenD

KrakenD Enterprise offers an OpenAPI importer which allows you to seamlessly import your API definitions from AWS. With this feature, you can easily integrate your AWS-hosted APIs with KrakenD Enterprise without the need for manual configuration. This can save you time and effort, especially if you have a large number of APIs to manage.

The OpenAPI importer supports the latest OpenAPI v3 specification, making it easy for anyone, regardless of their familiarity with KrakenD Enterprise or OpenAPI, to import API definitions with just a few commands and effectively manage their APIs.

Step 3: Configuring KrakenD Based on Imported AWS API Gateway Configuration

After successfully importing the OpenAPI configuration, your next step is to configure KrakenD. Using the imported configuration as your starting point, you’ll need to review and adjust the settings to ensure a seamless integration with your existing services. Here are some considerations:

  1. Network Configuration: Carefully review the network parameters to ensure that KrakenD can successfully communicate with your services. This might involve setting up firewalls, adjusting routing rules, or other network-related configurations.
  2. Permissions: Just like when using AWS API Gateway, your KrakenD instance will need the correct permissions to interact with your services. For AWS services, this will be controlled through IAM permissions. Review your IAM roles and policies to ensure that KrakenD has the necessary access to any required service.
  3. Integration with AWS Services: A key benefit of migrating to KrakenD is that your API Gateway will be still compatible with your AWS ecosystem services. It will allow you to continue utilizing AWS Lambdas, monitoring services like AWS X-Ray, or AWS Key Management Service (KMS). This ensures you don’t lose your existing AWS capabilities while gaining the benefits of KrakenD’s robust feature set.

Remember, thorough testing at this stage will help ensure a smooth migration. Consider using a testing or staging environment before implementing changes in your production environment.

Step 4: Testing

Before fully transitioning, there are a few steps you should take to ensure that your setup is functioning properly. First, test your setup by using a new domain to verify that all APIs are functioning as expected. This will help you identify any issues with routing or response handling that may not be apparent in your current setup.

Once you have verified that your APIs are working correctly, it’s important to validate your logging, metrics, and tracing setup. This will help you identify any issues with data collection or aggregation that may impact your ability to monitor and debug your system.

To validate your setup, we recommend using tools such as https://github.com/opendiffy/diffy. This will allow you to compare responses from your new domain against your current setup and identify any differences that may indicate issues with your system.

Step 5: Consider KrakenD production deployment best practices

As you plan your migration, it’s critical to consider KrakenD’s best practices for production deployment. This section will provide a high-level overview of the most essential architecture recommendations.

Architecture Recommendations:

  1. High Availability: Ensure redundancy by operating a cluster of KrakenD servers/containers for high availability. KrakenD nodes can run in different regions and data centers without needing to communicate with each other.
  2. Load Balancer: Implement a load balancer in front of KrakenD to distribute traffic across the cluster nodes. This is crucial for achieving high availability and optimal performance.
  3. Server Dimensioning: Make sure to size your KrakenD nodes based on your expected needs and throughput.
  4. Multiple Gateways: Consider using independent KrakenD installations for different consumer types to optimize the contract for each case.

To get a comprehensive understanding of KrakenD’s production best practices, including strategies for organizing your code, automating deployment processes, and utilizing Docker and immutable containers, refer to our official documentation on deploying KrakenD API Gateway. This documentation also covers blue/green deployment and other configuration optimizations, making it an essential resource for a smooth migration from AWS API Gateway to KrakenD.

Step 6: Transition and Monitor

Once your tests are successful, you can start transitioning your traffic to KrakenD. This could be done incrementally to minimize potential impact on your operations. Continue to monitor your KrakenD setup closely during this transition period and make adjustments as necessary. For more information on monitoring and telemetry, refer to KrakenD’s documentation on telemetry which includes best practices for collecting and analyzing performance metrics, logs, and traces, with many ready-to-use exporters available beyond X-Ray, like Grafana+InfluxDB, Prometheus, ELK or Datadog, among others.

Post-Migration

After the transition, continue monitoring your APIs to ensure they are performing as expected. KrakenD’s advanced metrics and logging capabilities will aid in this process. Regularly check for any potential issues and resolve them promptly to ensure a smooth operational experience.

Conclusion

Migrating from AWS API Gateway to KrakenD API Gateway can bring significant benefits, but it requires careful planning and execution. Following this guide and understanding the primary steps and considerations should help you navigate this process with more ease. As always, refer to the official KrakenD documentation or support forums for additional guidance.


Explore KrakenD Enterprise

Interested in leveraging the full power of KrakenD Enterprise for your API management needs? Our team is ready to help. Reach out today and let us empower your journey. Contact us for more information.

Scarf

Stay up to date with KrakenD releases and important updates