How to deploy WSO2 API Manager on EC2 instance

Note: You may need to follow additional guidelines such as securing ports, configuring databases, setting up other services for production deployment.

Step 1 — Create an EC2 Instance

In launch instance wizard for EC2 instances in AWS Console:

  1. Choose Ubuntu Server 20.04 LTS (HVM) as Amazon Machine Image.
  2. Choose c5.large or t2.xlarge as the Instance Type.
  3. Skip Instance Details section.
  4. Set storage size to 20GiB.
  5. Skip Tags section.
  6. Change Type to All Traffic in current security group.
    (Note that we will be using this instance for testing purposes)
  7. Create and download a new key pair and launch the instance.

Step 2 — Configure EC2 Instance

Open terminal (or command prompt) in your local machine and setup EC2 instance using following commands.

  1. Login to EC2 Instance
    ssh -i <path-to-key-pair-file> ubuntu@<public-ipv4-dns-address>
  2. Update packages
    sudo apt update
  3. Install Java
    sudo apt install default-jdk
  4. Set JAVA_HOME
    (i) sudo nano /etc/environment
    (ii) Add JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64"to environment file and save it
    (iii) source /etc/environment
    (iv) echo $JAVA_HOME
  5. Install Unzip
    sudo apt install unzip

Step 3 — Get WSO2 API Manager on EC2 Instance

  1. Go to WSO2 API Manager’s download page using this link
  2. Download WSO2 API Manager 4.0.0 — Zip Archive into your local machine
  3. Copy the zip file to EC2 Instance
    scp -i <path-to-key-pair-file> <path-to-downloaded-zip-file> ubuntu@<public-ipv4-dns-address>:~/
  4. Login to EC2 Instance
    ssh -i <path-to-key-pair-file> ubuntu@<public-ipv4-dns-address>
  5. Extract both zip files
    unzip wso2am-4.0.0.zip

Step 4 — Change Configurations

  1. Open deployment.toml file in API-M directory
    sudo nano wso2am-4.0.0/repository/conf/deployment.toml
  2. Change hostname="localhost" to hostname="<public-ipv4-dns-address>"
  3. Save and close deployment.toml file

Step 5 — Run WSO2 API Manager

  1. Start API Manager server
    sh wso2-4.0.0/bin/api-manager.sh
  2. You can visit WSO2 API Manager portals using following links.

Publisher Portal: https://<public-ipv4-dns-address>:9443/publisher
Developer Portal: https://<public-ipv4-dns-address>:9443/devportal
Admin Portal: https://<public-ipv4-dns-address>:9443/admin
Carbon Console: https://<public-ipv4-dns-address>:9443/carbon

If you get Registered callback does not match with the provided url error please follow the instructions in following link.

That’s it! Thanks for reading my article.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Binod Karunanayake

Binod Karunanayake

BSc Engineering (Hons) Department of Computer Science and Engineering of University of Moratuwa | Software Engineer @WSO2