// Module included in the following assemblies:
//
// * cloud_experts_tutorials/cloud-experts-using-alb-and-waf.adoc

:_mod-docs-content-type: PROCEDURE
[id="cloud-experts-using-alb-and-waf-deploy-sample-application_{context}"]
= Deploy a sample application

[role="_abstract"]
Deploy a sample application with an AWS Application Load Balancer (ALB) Ingress to verify your load balancer configuration.

.Procedure
. Create a new project for the sample application:
+
[source,terminal]
----
$ oc new-project hello-world
----

. Deploy a `hello-world` application:
+
[source,terminal]
----
$ oc new-app -n hello-world --image=docker.io/openshift/hello-openshift
----

. Convert the pre-created service resource to a NodePort service type:
+
[source,terminal]
----
$ oc -n hello-world patch service hello-openshift -p '{"spec":{"type":"NodePort"}}'
----

. Deploy an AWS ALB using the AWS Load Balancer Operator:
+
[source,terminal]
----
$ cat << EOF | oc apply -f -
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: hello-openshift-alb
  namespace: hello-world
  annotations:
    alb.ingress.kubernetes.io/scheme: internet-facing
spec:
  ingressClassName: alb
  rules:
    - http:
        paths:
          - path: /
            pathType: Exact
            backend:
              service:
                name: hello-openshift
                port:
                  number: 8080
EOF
----

. Curl the AWS ALB Ingress endpoint to verify the `hello-world` application is accessible:
+
[NOTE]
====
AWS ALB provisioning takes a few minutes. If you receive an error that says `curl: (6) Could not resolve host`, please wait and try again.
====
+
[source,terminal]
----
$ INGRESS=$(oc -n hello-world get ingress hello-openshift-alb -o jsonpath='{.status.loadBalancer.ingress[0].hostname}')
$ curl "http://${INGRESS}"
----
+
.Example output
[source,text]
----
Hello OpenShift!
----
