Running Liferay DXP in Amazon Web Services

There are three ways to host Liferay DXP in AWS:

  1. Installing Liferay DXP using the “plain” Helm chart.

  2. Installing Liferay DXP from AWS Marketplace.

  3. Installing Liferay DXP from GovCloud.

Once you’ve installed Liferay, you can set it up with portal properties, environment variables, and more. For more information, see Configuring Liferay in AWS.

Prerequisites

For all installation methods, you need these utilities installed:

  1. Install the Helm CLI.

  2. Install the kubectl CLI.

GovCloud users can skip installing these; but other installation methods need them:

  1. Install Git CLI.

  2. Install AWS CLI.

  3. Configure AWS CLI to use your IAM credentials.

  4. Install the Terraform CLI.

Log into AWS

First, use the CLI to log into AWS.

  1. Export your profile to use for the AWS SDK and its tools:

    export AWS_PROFILE=[profile name]
    
  2. Log into AWS.

    aws sso login
    

Clone the Terraform Files

Next, clone the terraform files from the repository:

git clone -n --depth=1 --filter=tree:0 https://github.com/liferay/liferay-portal.git liferay-aws-terraform
cd liferay-aws-terraform
git sparse-checkout set --no-cone /cloud/terraform/aws
git checkout
cd cloud/terraform/aws

Now you have all the files necessary to interface with an EKS cluster. Next, you can

  1. Create a new EKS cluster, or

  2. Use an existing EKS cluster.

Create a New EKS Cluster

Use the Terraform CLI to create a new EKS cluster with sensible defaults.

  1. From your terminal’s working directory after the previous step (liferay-aws-terraform/cloud/terraform/aws/), navigate to the eks/ directory.

  2. Run these Terraform commands:

    terraform init
    
    terraform apply
    
  3. Write the result of the terraform output command to the terraform.tfvars file in the dependencies/ directory (in liferay-aws-terraform/cloud/terraform/aws/):

    terraform output > ../dependencies/terraform.tfvars
    

Excellent! You’ve created a new EKS cluster for running Liferay.

Use an Existing EKS Cluster

Create dependent services to use with your EKS cluster:

  1. Navigate to the eks directory.

  2. Add your EKS cluster to your local kubeconfig:

    aws eks update-kubeconfig \
        --name $(terraform output -raw cluster_name) \
        --region $(terraform output -raw region)
    
  3. Run kubectl cluster-info to make sure the correct EKS cluster is configured.

  4. Set and export the KUBE_CONFIG_PATH environment variable:

    export KUBE_CONFIG_PATH="${HOME}/.kube/config"
    

Excellent! You’ve configured your EKS cluster to run Liferay.

Provision Liferay Dependencies on AWS Managed Services

Now it’s time to provide the necessary environment in which Liferay can run. As configured, the dependencies Terraform module provisions an RDS PostgreSQL database, an S3 object storage bucket, and an OpenSearch domain, along with the managed-service-details Kubernetes Secret that provides the necessary environment variables to the Liferay Helm chart.

  1. Navigate to the dependencies/ directory (in liferay-aws-terraform/cloud/terraform/aws/).

  2. If you configured a new EKS cluster, ensure the KUBE_CONFIG_PATH environment variable is set to your local kubeconfig path (you did this above if you configured an existing cluster):

    export KUBE_CONFIG_PATH="${HOME}/.kube/config"
    
  3. Run these Terraform commands:

    terraform init
    
    terraform apply
    
  4. Set an export the AWS service account role’s ARN, which was generated by Terraform:

    export AWS_SA_ROLE_ARN=$(terraform output -raw liferay_sa_role)
    

Awesome. You’re almost ready to launch Liferay.

Next, choose how to install Liferay: