Running Liferay DXP in Amazon Web Services
There are three ways to host Liferay DXP in AWS:
-
Installing Liferay DXP using the “plain” Helm chart.
-
Installing Liferay DXP from AWS Marketplace.
-
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:
-
Install the Helm CLI.
-
Install the kubectl CLI.
GovCloud users can skip installing these; but other installation methods need them:
-
Install Git CLI.
-
Install AWS CLI.
-
Configure AWS CLI to use your IAM credentials.
-
Install the Terraform CLI.
Log into AWS
First, use the CLI to log into AWS.
-
Export your profile to use for the AWS SDK and its tools:
export AWS_PROFILE=[profile name] -
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
Create a New EKS Cluster
Use the Terraform CLI to create a new EKS cluster with sensible defaults.
-
From your terminal’s working directory after the previous step (
liferay-aws-terraform/cloud/terraform/aws/), navigate to theeks/directory. -
Run these Terraform commands:
terraform initterraform apply -
Write the result of the
terraform outputcommand to theterraform.tfvarsfile in thedependencies/directory (inliferay-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:
-
Navigate to the
eksdirectory. -
Add your EKS cluster to your local kubeconfig:
aws eks update-kubeconfig \ --name $(terraform output -raw cluster_name) \ --region $(terraform output -raw region) -
Run
kubectl cluster-infoto make sure the correct EKS cluster is configured. -
Set and export the
KUBE_CONFIG_PATHenvironment 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.
-
Navigate to the
dependencies/directory (inliferay-aws-terraform/cloud/terraform/aws/). -
If you configured a new EKS cluster, ensure the
KUBE_CONFIG_PATHenvironment variable is set to your localkubeconfigpath (you did this above if you configured an existing cluster):export KUBE_CONFIG_PATH="${HOME}/.kube/config" -
Run these Terraform commands:
terraform initterraform apply -
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: