// Module included in the following assemblies:
//
// * installing/installing_aws/aws-compute-edge-zone-tasks.adoc

:_mod-docs-content-type: PROCEDURE
[id="installation-extend-edge-nodes-aws-local-zones_{context}"]
= Creating user workloads in AWS Local Zones or Wavelength Zones

[role="_abstract"]
After you create an {aws-first} {zone-type} infrastructure and deploy your cluster, you can use edge compute nodes to create user workloads in {zone-type} subnets.

.Prerequisites

* You have access to the {oc-first}.
* You deployed your cluster in a Virtual Private Cloud (VPC) with defined {zone-type} subnets.
* You ensured that the compute machine set for the edge compute nodes on {zone-type} subnets specifies the taints for `node-role.kubernetes.io/edge`.

.Procedure

. Create a `deployment` resource YAML file for an example application to be deployed in the edge compute node that operates in a Local Zones subnet. Ensure that you specify the correct tolerations that match the taints for the edge compute node.
+
.Example of a configured `deployment` resource for an edge compute node that operates in a Local Zone subnet
[source,yaml]
----
kind: Namespace
apiVersion: v1
metadata:
  name: <local_zone_application_namespace>
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: <pvc_name>
  namespace: <local_zone_application_namespace>
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi
  storageClassName: gp2-csi
  volumeMode: Filesystem
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: <local_zone_application>
  namespace: <local_zone_application_namespace>
spec:
  selector:
    matchLabels:
      app: <local_zone_application>
  replicas: 1
  template:
    metadata:
      labels:
        app: <local_zone_application>
        zone-group: ${ZONE_GROUP_NAME}
    spec:
      securityContext:
        seccompProfile:
          type: RuntimeDefault
      nodeSelector:
        machine.openshift.io/zone-group: ${ZONE_GROUP_NAME}
      tolerations:
      - key: "node-role.kubernetes.io/edge"
        operator: "Equal"
        value: ""
        effect: "NoSchedule"
      containers:
        - image: openshift/origin-node
          command:
           - "/bin/socat"
          args:
            - TCP4-LISTEN:8080,reuseaddr,fork
            - EXEC:'/bin/bash -c \"printf \\\"HTTP/1.0 200 OK\r\n\r\n\\\"; sed -e \\\"/^\r/q\\\"\"'
          imagePullPolicy: Always
          name: echoserver
          ports:
            - containerPort: 8080
          volumeMounts:
            - mountPath: "/mnt/storage"
              name: data
      volumes:
      - name: data
        persistentVolumeClaim:
          claimName: <pvc_name>
----
+
where:

`storageClassName`:: You must specify this the Local Zone configuration.
`kind`:: Defines the `deployment` resource.
`name`:: Specifies the name of your Local Zone application. For example, `local-zone-demo-app-nyc-1`.
`namespace`:: Defines the namespace for the {aws-short} Local Zone where you want to run the user workload. For example: `local-zone-app-nyc-1a`.
`zone-group`:: Defines the group to where a zone belongs. For example, `us-east-1-iah-1`.
`nodeSelector`:: Targets edge compute nodes that match the specified labels.
`tolerations`:: Sets the values that match with the `taints` defined on the `MachineSet` manifest for the Local Zone node.

. Create a `service` resource YAML file for the node. This resource exposes a pod from a targeted edge compute node to services that run inside your Local Zone network.
+
.Example of a configured `service` resource for an edge compute node that operates in a Local Zone subnet
[source,yaml]
----
apiVersion: v1
kind: Service
metadata:
  name:  <local_zone_application>
  namespace: <local_zone_application_namespace>
spec:
  ports:
    - port: 80
      targetPort: 8080
      protocol: TCP
  type: NodePort
  selector:
    app: <local_zone_application>
----
+
where:

`kind`:: Defines the `service` resource.
`selector`:: Specifies the label type applied to managed pods.