# Aws script to shutdown kafka

**URL:** <https://forum.confluent.io/t/aws-script-to-shutdown-kafka/4109>\
**Category:** Ops\
**Created:** [7 February 2022 21:35 UTC](https://forum.confluent.io/t/aws-script-to-shutdown-kafka/4109 "2022-02-07T21:35:47Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Erosney](https://avatars.discourse-cdn.com/v4/letter/e/0ea827/32.png) [@Erosney](https://forum.confluent.io/u/Erosney)\
**Post date:** [7 February 2022 21:35 UTC](https://forum.confluent.io/t/aws-script-to-shutdown-kafka/4109/1 "2022-02-07T21:35:47Z")

</div>

We would like to save money by shutdown Kafka on the weekend in aws. Does anyone has scripts to do that?

---

<div class="post-metadata">

**Author:** ![mmuehlbeyer](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/mmuehlbeyer/32/1088_2.png) [@mmuehlbeyer](https://forum.confluent.io/u/mmuehlbeyer)\
**Post date:** [8 February 2022 08:21 UTC](https://forum.confluent.io/t/aws-script-to-shutdown-kafka/4109/2 "2022-02-08T08:21:07Z")

</div>

Hi @Erosney

welcome to the forum 🙂

just to be sure:  
are you running a self managed Kafka cluster on EC2 instances?

best  
michael

---

<div class="post-metadata">

**Author:** ![Erosney](https://avatars.discourse-cdn.com/v4/letter/e/0ea827/32.png) [@Erosney](https://forum.confluent.io/u/Erosney)\
**Post date:** [8 February 2022 15:12 UTC](https://forum.confluent.io/t/aws-script-to-shutdown-kafka/4109/3 "2022-02-08T15:12:17Z")

</div>

No. They aren’t Managed clusters.

---

<div class="post-metadata">

**Author:** ![mmuehlbeyer](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/mmuehlbeyer/32/1088_2.png) [@mmuehlbeyer](https://forum.confluent.io/u/mmuehlbeyer)\
**Post date:** [8 February 2022 15:30 UTC](https://forum.confluent.io/t/aws-script-to-shutdown-kafka/4109/4 "2022-02-08T15:30:51Z")

</div>

mmh not clear how your architecture/deployment looks like.  
good you provide some details?

best

---

<div class="post-metadata">

**Author:** ![gklijs](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/gklijs/32/223_2.png) [@gklijs](https://forum.confluent.io/u/gklijs)\
**Post date:** [8 February 2022 18:18 UTC](https://forum.confluent.io/t/aws-script-to-shutdown-kafka/4109/5 "2022-02-08T18:18:49Z")

</div>

If it’s EKS, you need some way to store and restore the data AFAIK, since you can only do so by destroying the cluster. Optionally you could switch to other instances for the weekend. But without knowing your setup, it’s hard to give proper advise.

---

<div class="post-metadata">

**Author:** ![Erosney](https://avatars.discourse-cdn.com/v4/letter/e/0ea827/32.png) [@Erosney](https://forum.confluent.io/u/Erosney)\
**Post date:** [8 February 2022 18:50 UTC](https://forum.confluent.io/t/aws-script-to-shutdown-kafka/4109/6 "2022-02-08T18:50:44Z")

</div>

The architecture/deployment it’s EKS

---

<div class="post-metadata">

**Author:** ![mmuehlbeyer](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/mmuehlbeyer/32/1088_2.png) [@mmuehlbeyer](https://forum.confluent.io/u/mmuehlbeyer)\
**Post date:** [9 February 2022 07:49 UTC](https://forum.confluent.io/t/aws-script-to-shutdown-kafka/4109/7 "2022-02-09T07:49:15Z")

</div>

hi  
as @gklijs mentioned there is no optimal way to stop the cluster

one thing you could think about is to scale the kafka and zookeeper replicas to 0, though I’m not sure whether it has that big effect on costs

another thing might be to backup the cluster, stop/destroy the cluster on Friday and recreate the cluster and restore the data on Monday

there is a nice blog post how to implement it

> **[Backup and Restore Apache Kafka Deployments on Kubernetes](https://docs.bitnami.com/tutorials/backup-restore-data-kafka-kubernetes/)**
>
> This tutorial describes how to backup data from, and restore data to, Apache Kafka deployments on Kubernetes

never tested in a real world setup but sounds promising

best,  
michael

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/confluentcommunity/original/1X/c49438c90c9df282e9996fdf6971be890c71b65a.svg) [@system](https://forum.confluent.io/u/system)\
**Post date:** [25 February 2022 15:06 UTC](https://forum.confluent.io/t/aws-script-to-shutdown-kafka/4109/8 "2022-02-25T15:06:41Z")

</div>

Closed on 25 February 2022 15:06 UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
