There are plenty of reasons to migrate from WSO2 to Tyk. Are you looking for affordable, consistent pricing? Easy versioning? Stability? Stellar customer support? Whatever you’re seeking, it’s easier than you might think to migrate to Tyk from WSO2. Let us show you how.
Flexible migration options
When you’ve invested in an integration, API and identity management solution, the idea of changing to another provider might feel daunting – but Tyk cuts through the complexity to make your migration painless.
We look at why you might want to migrate away from WSO2, so today we’re going to focus on the how.
We use a typical ETL (extract, transform, load) process to enable your migration. You can use either a GUI-based approach or a CLI-based approach, depending on what you prefer. Either way, the process follows four simple steps:
- Export API data from WSO2
- Extract OAS document from exported data
- Extract values from OAS document
- Import OAS and extracted values into Tyk
That’s it. Migration done!
Using the GUI-based approach
Let’s dive into some more detail about how easily you can migrate to Tyk. If you’re taking the GUI-based approach, you can use the WSO2 Publisher to export the API data. Then you just need to transform it before importing it using the Tyk Dashboard.
In practice, you can carry out the following steps to achieve this:
- Log into the WSO2 Publisher.
- Go to the APIs section and select the API you want to export.
- Click ‘Download API’.
- Save and extract the resulting zip archive file.
- Convert the Definitions/swagger.yaml file from YAML to JSON (using your favorite YAML to JSON convertor) and copy the resulting OAS JSON document to your clipboard.
- Log into the Tyk Dashboard.
- Go to the APIs section and click ‘Add New API’, then ‘Import’.
- Select ‘OpenAPI’ as your import type and then ‘Paste API Definition’ as your import content.
- Paste your OAS JSON document into the Definition field.
- Check the Custom Listen Path checkbox and copy the OAS document
x-wso2-basePath
value into the Listen Path field. - Select the Custom Upstream URL checkbox and copy the OAS document
x-wso2-production-endpoints
value into the Upstream URL field. Note that the URL must be reachable from the Tyk Gateway, so you may need to amend it, depending on your network configuration. - Check the Apply Detected Authentication checkbox if you want Tyk to apply the authentication method defined in the OAS. If you want to set up the API without authentication initially, leave it unchecked.
- Click ‘Import API’, sit back and marvel at how simple that was.
The API is now accessible through Tyk Gateway. Remember to recreate any API policies, clients and access tokens in Tyk after your import.
Using the CLI-based approach
As an alternative to the GUI-based approach, you can use CLI tools to migrate API definitions from WSO2 to Tyk. We’ll use WSO2’s sample API, the PizzaShackAPI, to walk you through how to do so, along with the following tools:
apictl
: WSO2 CLI tool, to export APIs from WSO2 – we’ve assumed for this example that it’s configured with a source environment calledwso2-source
and that it’s authenticated with that environmentunzip
: Zip archive tool, to extract files from zip archivesjq
: JSON parsing tool, to extract data from OAS documentscurl
: HTTP client, to import APIs into Tyk
Right, let’s crack on with the steps to migrate to Tyk using the CLI-based approach. First, export the PizzaShackAPI from WSO2 using the apictl
tool to produce a zip archive that contains the OAS document in JSON format:
apictl export api -e wso2-source -n PizzaShackAPI -v 1.0.0 --format json
Your zip archive will now be available in within the apictl application directory at:
~/.wso2apictl/exported/apis/wso2-source/PizzaShackAPI_1.0.0.zip
Now you need to extract the OAS document from the zip archive to swagger.json:
unzip -p ~/.wso2apictl/exported/apis/wso2-source/PizzaShackAPI_1.0.0.zip PizzaShackAPI-1.0.0/Definitions/swagger.json > swagger.json
Next, it’s time to extract the base path and production endpoint data from the OAS document to environment variables. You’ll be using the value of these to override the Tyk listen path and upstream URL, so ensure the values are URL encoded.
Base path:
export WSO2_BASE_PATH=$(jq -r '."x-wso2-basePath" | @uri' swagger.json)
Production endpoint:
export WSO2_PRODUCTION_ENDPOINT=$(jq -r '."x-wso2-production-endpoints".urls[0] | @uri' swagger.json)
Update the values to be URL encoded, so that you can use them as URL parameters. Next, import the OAS document into the Tyk Dashboard, overriding the listen path and upstream URL. You’ll need to replace YOUR_TYK_DASHBOARD_API_KEY
with your actual Tyk dashboard API key before running this command:
curl -X POST "http://tyk-dashboard.localhost:3000/api/apis/oas/import?listenPath={$WSO2_BASE_PATH}&upstreamURL=${WSO2_PRODUCTION_ENDPOINT}" \ -H "Authorization: e6110fdeabe94da657f816e2243985a7" \ -H "Content-Type: application/json" \ -d @swagger.json
Your API is now available in Tyk, accessible via the gateway. If you curl the /menu endpoint, for example, you’ll see it returns a JSON response containing menu data. Nice work.
Automating data migration
Want an even easier life? We’ve looked above at how to migrate a single API from WSO2 to Tyk, but what if you want to migrate all APIs?
This is where the power of automation comes in. You can use a script that loops through each API in WSO2 and processes them automatically. It means you can start enjoying the seamless scalability and powerful analytics that Tyk provides even faster. All by using a script available on Tyk’s GitHub repository.
You’ll need connection details for both WSO2 and Tyk to use the script. Then, you can sit back and relax while it automates the process of exporting all your APIs from WSO2 and importing them into Tyk.
As an example, the following command sets the WSO2 source to https://localhost:9443
with admin as the username and password. It also configures the Tyk destination to http://localhost:3000 and uses e6110fdeabe94da657f816e2243985a7
as the token:
./migrate-api-wso2-tyk.sh \ --wso2-host https://source-wso2-publisher:9443 \ --wso2-username admin \ --wso2-password admin \ --tyk-host http://target-tyk-dashboard:3000 \ --tyk-token 8d6ab54f997642d659847e17d5f4737e
The script will provide real-time updates as it runs, so you can see the migration process in action. When it’s finished, you can log into the Tyk Dashboard, review the migrated API definitions and access them via the Tyk Gateway.
A few additional pointers
To ensure a seamless migration away from WSO2 to Tyk, you’ll need to ensure the Tyk Gateway can connect to the upstream hosts of the imported APIs. Additionally, if the migrated API upstream services are using self-signed certificates, you’ll need to configure Tyk to skip SSL verification – you can find the details you need here.
Get more from your API management
As we’ve demonstrated above, Tyk has no steep learning curve or challenging navigation, so you can get faster value from your API management infrastructure. Our API solution is highly customizable, flexes around your needs and delivers clear, predictable pricing. We support a wide range of protocols: REST, SOAP, GraphQL, Websockets, TCP and gRPC – so you’re not just stuck in a service mesh echo chamber.
We want you to benefit from all this and more when you migrate to Tyk’s lightweight, powerful API management solution, so our team is always here to help. You can reach out to one of our experts if you have any questions about the migration process.
Alternatively, you can get stuck in and trial our full features for free (with no credit card details required) to get to know Tyk on your own terms. We think you’ll be delighted with how simple and intuitive the experience is.