= Cost optimization

When Workload Discovery on AWS is not in use, you can deactivate the ECS scheduled task and stop the Amazon Neptune database to reduce costs.

== Using the AWS Management Console

To deactivate the discovery process and stop the Amazon Neptune database:

. Sign in to the https://console.aws.amazon.com/ecs/home[ Amazon Elastic
Container Service console].
. Select the cluster named *workload-discovery-cluster*.
. Select *Scheduled Tasks*.
. Select *workload-discovery-rule*.
. Choose *Edit*.
. Clear the *Schedule rule enabled* checkbox and choose *Update*.
. Sign in to the https://console.aws.amazon.com/neptune/home[Amazon
Neptune console].
. For the DB identifier, select the *wdneptunedbcluster-<ID-string>* radio box.
. Select the *Stop* option from the *Action* dropdown menu.

To reactivate the discovery process and stop the Amazon Neptune database:

. Sign in to the https://console.aws.amazon.com/ecs/home[ Amazon Elastic
Container Service console].
. Select the cluster named *workload-discovery-cluster*.
. Select *Scheduled Tasks*.
. Select *workload-discovery-rule*.
. Choose *Edit*.
. Select the *Schedule rule enabled* checkbox and choose *Update*.
. Sign in to the https://console.aws.amazon.com/neptune/home[Amazon
Neptune console].
. For the DB identifier, select the *wdneptunedbcluster-<ID-string>* radio box.
. Select the *Start* option from the *Action* dropdown menu.

When the reactivated discovery task has completed for the first time, any new resources that have been deployed since Workload Discovery on AWS was disabled will be discovered.

== Using the AWS Command Line Interface (AWS CLI)

Determine whether the AWS Command Line Interface (AWS CLI) is available in your environment.
For installation instructions, refer to
https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html[What
Is the AWS Command Line Interface?] in the _AWS CLI User Guide_.

To deactivate the discovery process and stop the Amazon Neptune database:

. To deactivate the discovery process, run the following command:
+
[source,programlisting]
----
aws events disable-rule --name workload-discovery-rule
----
. To stop the Amazon Neptune database, run the following command:
+
[source,programlisting]
----
aws neptune stop-db-cluster --db-cluster-identifier wdneptunedbcluster-<ID-string>.
----

To reactivate the discovery process and restart the Amazon Neptune database:

. To reactivate the discovery process, run the following command:
+
[source,programlisting]
----
aws events enable-rule --name workload-discovery-rule
----
. To restart the Amazon Neptune database, run the following command:
+
[source,programlisting]
----
aws neptune start-db-cluster --db-cluster-identifier wdneptunedbcluster-<ID-string>
----

When the reactivated discovery task has ran for the first time, any new resources that have been deployed since the service was disabled will be discovered.