Deployment steps - Migrating Magento Open Source or Adobe Commerce on Cloud Infrastructure Self-Service to AWS

Deployment steps

The procedure for deploying a Magento cluster on AWS consists of the following steps. For detailed instructions, follow the links for each step.

Step 1. Prepare an AWS account

  1. If you don’t already have an AWS account, create one at by following the on-screen instructions. Part of the sign-up process involves receiving a phone call and entering a PIN using the phone keypad.

  2. Use the Region selector in the navigation bar to choose the AWS Region where you want to deploy the Magento cluster on AWS. For more information, see Regions and Availability Zones. Regions are dispersed and located in separate geographic areas. Each Region includes at least two Availability Zones that are isolated from one another but connected through low-latency links.


    This Quick Start uses Amazon Aurora, which might not be available in all AWS Regions. Before you launch this Quick Start, check the Region table for availability.

              Screen capture showing choosing an AWS Region

    Figure 3 – Choosing an AWS Region


    Consider choosing a Region closest to your data center or corporate network to reduce network latency between systems running on AWS and the systems and users on your corporate network.

  3. Create a key pair in your preferred Region. In the navigation pane of the Amazon EC2 console, choose Key Pairs, Create Key Pair, type a name, and then choose Create.

              Screen showing creating a key pair

    Figure 4 – Creating a key pair

    Amazon EC2 uses public-key cryptography to encrypt and decrypt login information. To be able to log into your instances, you must create a key pair. On Linux, we use the key pair to authenticate SSH login.

    For this deployment, store the private key you created in the previous step in Secrets Manager using the AWS Management Console as plaintext.

    1. In the AWS Management Console, navigate to AWS Secrets Manager, choose your AWS Region, and choose Store a new secret.

    2. Select Other type of secrets and choose Plaintext.

    3. Clear the {"":""} JSON format from the Plaintext section.

    4. Copy and paste your private key.

                  Screen shot showing copying key

      Figure 5 – Copying key

    5. Keep the DefaultEncryptionKey to encrypt your SSH Key secret. Click Next.

    6. Set the secret name as "ssh-key-admin"

    7. Click Next. Leave the automatic rotation to disabled. Select Next.

    8. Review and select Store.

                  Screenshot showing reviewing secrets

      Figure 6 – Reviewing secrets

  4. If necessary, request a service quota increase for the instance types used for the deployment. You might need to request an increase if you need additional Elastic IP addresses or if you already have an existing deployment that uses the same instance types as this architecture. On the Service Quotas console, for each instance type that you want a service quota increase, choose the instance type, choose Request quota increase, and then complete the fields in the quota increase form. It can take a few days for the new service quota to become effective.

              Screenshot showing requesting a service quota increase

    Figure 7 – Requesting a service quota increase

Step 2. Create Magento keys for deployment

This deployment use Magento Composer to manage Magento components and their dependencies. To learn more about Magneto Composer, see the Adobe documentation.

  1. Create a Magento public authentication key for Composer Username.

  2. Create a Magento private authentication key for Composer Password.

For detailed instructions on creating keys, see the Adobe documentation.

          Screenshot showing creating a new Magento access key

Figure 8 – Creating a Magento access key

Step 3. Set up Terraform and a Terraform Cloud account

  1. Install Terraform. For installation steps, see the Terraform documentation.

  2. Set up a Terraform Cloud account. For setup instructions, see the Terraform Cloud documentation (There is a free tier available.)

  3. Create a workspace in Terraform to organize infrastructure. For setup instructions, see the TerraForm Cloud workspace documentation.

Step 4. Prepare local environment with Terraform setup

Generate a Terraform Cloud token:

terraform login

Export the TERRAFORM_CONFIG variable:

export TERRAFORM_CONFIG="$HOME/.terraform.d/credentials.tfrc.json"

Configure the tfvars file

Create terraform.tfvars in the following path:


An example of the tfvars file contents:

AWS_ACCESS_KEY_ID = "{insert access key ID}" AWS_SECRET_ACCESS_KEY = "{insert secret access key}" AWS_SESSION_TOKEN = "{insert session token}"

We recommend using AWS Security Token Service (AWS STS)–based credentials.


Follow best practices for managing secrets, and ensure that your credentials are not stored in a public repository.


Before deployment, you must create both an AWS key pair and a Magento deployment key.

Deploy the module (Linux and iOS)

  1. Clone the repository from GitHub.

  2. Navigate to the repository’s root directory.

  3. Navigate to the setup_workspace directory:

    cd setup_workspace
  4. Run the following commands in order:

    terraform init

    Alternatively, for the previous command, specify the file:

    terraform apply -var-file="$HOME/.aws/terraform.tfvars"
  5. You are asked for the following:

    1. The AWS Region where you want to deploy this module. This must match the Region where you generated the key pair.

    2. The organization under which Terraform Cloud runs. This can be found in the Terraform Cloud console.

    3. Setup confirmation.


    Terraform Cloud creates the workspace, which contains the Terraform Cloud organization name.

  6. Navigate to the directory, and deploy Magento (the previous terraform init command generates backend.hcl):

    cd ../deploy
    • Open, edit, and review all of the variables in the file.

    • Update the default= value for your deployment.

    • The description= value provides additional context for each variable.

      The following items must be edited before deployment:

      • Project-specific: domain_name

      • Magento information: mage_composer_username

      • Magento information: mage_composer_password

      • Magento information: magento_admin_password

      • Magento information: magento_admin_email

      • Database: magento_database_password

      • Variable base_ami_os: Use amazon_linux_2 or Debian_10.

      • Variable use_aurora: If you are using Amazon RDS for MySQL instead of Amazon Aurora, change to false.


      Don’t store secret information in a public repository.

  7. After you review, update and save the ./deploy/ file, see the Deployment section.

Run the following commands from an IDE or terminal with Terraform installed.

  1. Initialize the environment:

    terraform init
  1. Verify that the deployed architecture is correct: 

    terraform plan
  2. Validate the code: 

    terraform validate
  3. Deploy the infrastructure run one of the following commands:

    terraform apply


    terraform apply -var-file="$HOME/.aws/terraform.tfvars"