Red Hat Training

A Red Hat training course is available for OpenShift Container Platform

Chapter 17. Configuring for AWS

17.1. Overview

OpenShift Container Platform can be configured to access an AWS EC2 infrastructure, including using AWS volumes as persistent storage for application data. After AWS is configured properly, some additional configurations will need to be completed on the OpenShift Container Platform hosts.

17.2. Configuring AWS Variables

To set the required AWS variables, create a /etc/aws/aws.conf file with the following contents on all of your OpenShift Container Platform hosts, both masters and nodes:

Zone = us-east-1c 1
This is the Availability Zone of your AWS Instance and where your EBS Volume resides; this information is obtained from the AWS Managment Console.

17.3. Configuring OpenShift Container Platform Masters for AWS

You can set the AWS configuration on your OpenShift Container Platform master hosts in two ways:

17.3.1. Configuring OpenShift Container Platform for AWS with Ansible

During advanced installations, AWS can be configured using the openshift_cloudprovider_aws_access_key, openshift_cloudprovider_aws_secret_key, and openshift_cloudprovider_kind parameters, which are configurable in the inventory file.

Example 17.1. Example AWS Configuration with Ansible

# Cloud Provider Configuration
# Note: You may make use of environment variables rather than store
# sensitive configuration within the ansible inventory.
# For example:
#openshift_cloudprovider_aws_access_key="{{ lookup('env','AWS_ACCESS_KEY_ID') }}"
#openshift_cloudprovider_aws_secret_key="{{ lookup('env','AWS_SECRET_ACCESS_KEY') }}"
# Note: IAM profiles may be used instead of storing API credentials on disk.

When Ansible configures AWS, the following files are created for you:

  • /etc/aws/aws.conf
  • /etc/origin/master/master-config.yaml
  • /etc/origin/node/node-config.yaml
  • /etc/sysconfig/atomic-openshift-master
  • /etc/sysconfig/atomic-openshift-node

17.3.2. Manually Configuring OpenShift Container Platform Masters for AWS

Edit or create the master configuration file on all masters (/etc/origin/master/master-config.yaml by default) and update the contents of the apiServerArguments and controllerArguments sections:

      - "aws"
      - "/etc/aws/aws.conf"
      - "aws"
      - "/etc/aws/aws.conf"

Currently, the nodeName must match the instance name in AWS in order for the cloud provider integration to work properly. The name must also be RFC1123 compliant.


When triggering a containerized installation, only the directories of /etc/origin and /var/lib/origin are mounted to the master and node container. Therefore, aws.conf should be in /etc/origin/ instead of /etc/.

17.3.3. Manually Configuring OpenShift Container Platform Nodes for AWS

Edit or create the node configuration file on all nodes (/etc/origin/node/node-config.yaml by default) and update the contents of the kubeletArguments section:

    - "aws"
    - "/etc/aws/aws.conf"

When triggering a containerized installation, only the directories of /etc/origin and /var/lib/origin are mounted to the master and node container. Therefore, aws.conf should be in /etc/origin/ instead of /etc/.

17.4. Setting Key Value Access Pairs

Make sure the following environment variables are set in the /etc/sysconfig/atomic-openshift-master file on masters and the /etc/sysconfig/atomic-openshift-node file on nodes:


Access keys are obtained when setting up your AWS IAM user.

17.5. Applying Configuration Changes

Start or restart OpenShift Container Platform services on all master and node hosts to apply your configuration changes:

$ systemctl restart atomic-openshift-master
$ systemctl restart atomic-openshift-node

Switching from not using a cloud provider to using a cloud provider produces an error message. Adding the cloud provider tries to delete the node because the node switches from using the hostname as the externalID (which would have been the case when no cloud provider was being used) to using the AWS instance-id (which is what the AWS cloud provider specifies). To resolve this issue:

  1. Log in to the CLI as a cluster administrator.
  2. Check and backup existing node labels:

    $ oc describe node <node_name> | grep -Poz '(?s)Labels.*\n.*(?=Taints)'
  3. Delete the nodes:

    $ oc delete node <node_name>
  4. On each node host, restart the OpenShift Container Platform service.

    $ systemctl restart atomic-openshift-node
  5. Add back any labels on each node that you previously had.