// Module included in the following assemblies:
//
// * backup_and_restore/application_backup_and_restore/oadp-aws-sts/oadp-aws-sts.adoc

:_mod-docs-content-type: PROCEDURE
[id="performing-a-backup-oadp-aws-sts_{context}"]
= Performing a backup with OADP and AWS STS

[role="_abstract"]
Perform a backup by using {oadp-first} with {aws-first} (AWS STS). The following `hello-world` example application has no persistent volumes (PVs) attached.

Either Data Protection Application (DPA) configuration will work.

.Procedure

. Create a workload to back up by running the following commands:
+
[source,terminal]
----
$ oc create namespace hello-world
----
+
[source,terminal]
----
$ oc new-app -n hello-world --image=docker.io/openshift/hello-openshift
----

. Expose the route by running the following command:
+
[source,terminal]
----
$ oc expose service/hello-openshift -n hello-world
----

. Check that the application is working by running the following command:
+
[source,terminal]
----
$ curl `oc get route/hello-openshift -n hello-world -o jsonpath='{.spec.host}'`
----
+
[source,terminal]
----
Hello OpenShift!
----

. Back up the workload by running the following command:
+
[source,terminal]
----
$ cat << EOF | oc create -f -
  apiVersion: velero.io/v1
  kind: Backup
  metadata:
    name: hello-world
    namespace: openshift-adp
  spec:
    includedNamespaces:
    - hello-world
    storageLocation: ${CLUSTER_NAME}-dpa-1
    ttl: 720h0m0s
EOF
----

. Wait until the backup has completed and then run the following command:
+
[source,terminal]
----
$ watch "oc -n openshift-adp get backup hello-world -o json | jq .status"
----
+
[source,json]
----
{
  "completionTimestamp": "2022-09-07T22:20:44Z",
  "expiration": "2022-10-07T22:20:22Z",
  "formatVersion": "1.1.0",
  "phase": "Completed",
  "progress": {
    "itemsBackedUp": 58,
    "totalItems": 58
  },
  "startTimestamp": "2022-09-07T22:20:22Z",
  "version": 1
}
----

. Delete the demo workload by running the following command:
+
[source,terminal]
----
$ oc delete ns hello-world
----

. Restore the workload from the backup by running the following command:
+
[source,terminal]
----
$ cat << EOF | oc create -f -
  apiVersion: velero.io/v1
  kind: Restore
  metadata:
    name: hello-world
    namespace: openshift-adp
  spec:
    backupName: hello-world
EOF
----

. Wait for the Restore to finish by running the following command:
+
[source,terminal]
----
$ watch "oc -n openshift-adp get restore hello-world -o json | jq .status"
----
+
[source,json]
----
{
  "completionTimestamp": "2022-09-07T22:25:47Z",
  "phase": "Completed",
  "progress": {
    "itemsRestored": 38,
    "totalItems": 38
  },
  "startTimestamp": "2022-09-07T22:25:28Z",
  "warnings": 9
}
----

. Check that the workload is restored by running the following command:
+
[source,terminal]
----
$ oc -n hello-world get pods
----
+
[source,terminal]
----
NAME                              READY   STATUS    RESTARTS   AGE
hello-openshift-9f885f7c6-kdjpj   1/1     Running   0          90s
----
. Check the JSONPath by running the following command:
+
[source,terminal]
----
$ curl `oc get route/hello-openshift -n hello-world -o jsonpath='{.spec.host}'`
----
+
[source,terminal]
----
Hello OpenShift!
----

+

[NOTE]
====
For troubleshooting tips, see link:https://access.redhat.com/articles/5456281[troubleshooting documentation].
====

