184 Red Hat OpenShift and IBM Cloud Paks on IBM Power Systems: Volume 1
      storage: 2Gi
This scenario uses the same secret file used in the on-premise Power Systems cluster, as 
shown in Example 7-13 on page 170. The mongoDB Pod yaml file is also the same as used 
before as shown in Example 7-15 on page 171.
The service on AWS uses the load balancer that connects correctly the service on a 
predefined name on port 27017. To accomplish this, use the yaml file, as shown in 
Example 7-25.
Example 7-25   Service file for AWS
apiVersion: v1
kind: Service
metadata:
  labels:
    app: appmongo-ibm-mongodb-dev
  name: appmongo-ibm-mongodb-dev
spec:
  ports:
  - name: ibm-mongodb-dev
    port: 27017
    protocol: TCP
    targetPort: 27017
  selector:
    app: appmongo-ibm-mongodb-dev
  type: LoadBalancer
After applying all yaml files (as shown in Example 7-26), Mongodb is available in AWS.
Example 7-26   Applying all yaml files
[root@ip-10-0-2-217 ~]# oc apply -f csipv.yaml
persistentvolume/appmongo-ibm-mongodb-dev-datavolume created
[root@ip-10-0-2-217 ~]# oc apply -f csipvc.yaml
persistentvolumeclaim/appmongo-ibm-mongodb-dev-datavolume created
[root@ip-10-0-2-217 ~]# oc apply -f secret.yaml
secret/appmongo-ibm-mongodb-dev created
[root@ip-10-0-2-217 ~]# oc apply -f awsservice.yaml
service/appmongo-ibm-mongodb-dev created
[root@ip-10-0-2-217 ~]# oc apply -f mongo_pod.yaml
pod/appmongo-ibm-mongodb-dev created
[root@ip-10-0-2-217 ~]#
The service is created by AWS. To get the address, check the service, as shown in 
Example 7-27.
Example 7-27   Checking service created
[root@ip-10-0-2-217 ~]# oc get service appmongo-ibm-mongodb-dev
NAME                       TYPE           CLUSTER-IP      EXTERNAL-IP                                                              
PORT(S)           AGE
appmongo-ibm-mongodb-dev   LoadBalancer   172.30.43.162   
a1765d068fc8911e9b07106df2fba1c0-125393943.us-east-2.elb.amazonaws.com   
27017:31725/TCP   9d
[root@ip-10-0-2-217 ~]#