

# Managing a schedule group in EventBridge Scheduler
<a name="managing-schedule-group"></a>

A *schedule group* is an Amazon EventBridge Scheduler resource that you use to organize your schedules. 

Your AWS account comes with a `default` scheduler group. You can associate a new schedule with the `default` group or with schedule groups that you create and manage. You can create up to [500 schedule groups](https://docs.aws.amazon.com/scheduler/latest/UserGuide/scheduler-quotas.html) in your AWS account. With EventBridge Scheduler, you organize schedule groups, instead of individual schedules, by applying [tags](https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html). 

A *tag* is a label comprised of a case-sensitive key and a case-sensitive value that you define. You can create tags to categorize schedules by criteria like purpose, owner, or environment. For example, you can identify the environment that your schedules belong to with the following tag: `environment:production`. 

**Important**  
Do not add personally identifiable information (PII) or other confidential or sensitive information in tags. Tags are accessible to many AWS services, including billing. Tags are not intended to be used for private or sensitive data. 

A schedule group has two possible [states](https://docs.aws.amazon.com/scheduler/latest/APIReference/API_GetScheduleGroup.html#scheduler-GetScheduleGroup-response-State): **ACTIVE** and **DELETING**. 

When you first create a group, it is `ACTIVE` by default. You can add schedules to an `ACTIVE` group. When you delete a group, the state changes to `DELETING` until EventBridge Scheduler finishes the deletion of the associated schedules. After EventBridge Scheduler deletes the schedules in the group, the group is no longer available in your account. 

Use the following topics to create a schedule group and apply a tag to it. You'll also associate a schedule with the group. Finally, you'll delete the group. 

**Topics**
+ [Creating a schedule group in EventBridge Scheduler](managing-schedule-group-create.md)
+ [Deleting a schedule group in EventBridge Scheduler](managing-schedule-group-delete.md)
+ [Related resources](#managing-schedule-group-related-resources)

# Creating a schedule group in EventBridge Scheduler
<a name="managing-schedule-group-create"></a>

Use schedule groups and tagging to organize schedules that share a common purpose or belong to the same environment. In the following steps, you create a new schedule group and label it using a tag. You then associate a new schedule with that group. 

**Note**  
Once you create a group, you can't remove a schedule from that group, or associate the schedule with a different group. You can only associate a schedule with a group when you first create the schedule.

## Step one: Create a new schedule group
<a name="create-schedule-group"></a>

The following topics describe how to create a new schedule group and label it with the following tag: `environment:development`. 

------
#### [ AWS Management Console ]

**To create a new group using the AWS Management Console**

1. Sign in to the AWS Management Console and open the Amazon EventBridge console at [https://console.aws.amazon.com/events/](https://console.aws.amazon.com/events/).

1. In the left navigation pane, choose **Schedule groups**. 

1. On the Schedule groups page, choose **Create schedule group**. 

1. In the **Schedule group detail** section, for **Name**, enter a name for the group. For example, **TestGroup**. 

1. In the **Tags** section, do the following:

   1. Choose **Add new tag**.

   1. For **Key**, enter the name that you want to assign to this key. For this tutorial, to label the environment this schedule group belongs to, enter **environment**.

   1. For **Value - *optional***, enter the value that you want to assign to this key. For this tutorial, enter the value **development** for your environment key.
**Note**  
You can add additional tags to your group after you create it.

1. To finish, choose **Create schedule group**. Your new group appears in the **Schedule groups** list. 

1. (Optional) To edit a group or manage its tags, select the check box for the new group and choose **Edit**. 
**Note**  
You can't edit the `default` schedule group.

------
#### [ AWS CLI ]

**To create a new group using the AWS CLI**

1. Open a new command prompt window.

1. From the AWS Command Line Interface (AWS CLI), enter the following [https://awscli.amazonaws.com/v2/documentation/api/latest/reference/scheduler/create-schedule-group.html](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/scheduler/create-schedule-group.html) command to create a new group. This command creates a group with one tag: `environment:development`. You can use this tag or a similar tagging system to label your schedule groups according to the environment they belong to. 

   Replace the schedule name and the tag key and value with your information.

   ```
   $ aws scheduler create-schedule-group --name TestGroup --tags Key=environment,Value=development
   ```

------

By default, your new group is in the `ACTIVE` state. You can now associate new schedules with the new group you created. 

## Step two: Associating a schedule with the group
<a name="associate-schedule-with-group"></a>

Use the following steps to associate a new schedule with the group you created in the [previous step](#create-schedule-group). 

------
#### [ AWS Management Console ]

**To associate a schedule with a group using the AWS Management Console**

1. Sign in to the AWS Management Console and open the Amazon EventBridge console at [https://console.aws.amazon.com/events/](https://console.aws.amazon.com/events/).

1. In the left navigation pane, choose **Schedules** in the left navigation pane. 

1. From the **Schedules** table, choose **Create schedule** to create a new schedule. 

1. On the **Specify schedule details** page, for **Schedule group**, select the name of your new group from the drop down list. For example, select `TestGroup`. 

1. Specify a schedule pattern, target, settings then review your selection on the **Review and save schedule** page. For more information on configuring a new schedule, see [Getting started with EventBridge Scheduler](getting-started.md). 

1. To finish and save your schedule, choose **Save schedule**. 

------
#### [ AWS CLI ]

**To associate a schedule with a group using the AWS CLI**

1. Open a new command prompt window.

1. From the AWS Command Line Interface (AWS CLI), enter the following [https://awscli.amazonaws.com/v2/documentation/api/latest/reference/scheduler/create-schedule.html](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/scheduler/create-schedule.html) command. This creates a schedule and associates it with the group from the [previous step](#create-schedule-group), named `sqs-test-schedule`. This schedule uses the templated [Amazon SQS](managing-targets-templated.md#managing-targets-templated-sqs) target type to invoke the `SendMessage` operation. Replace the schedule name, target, and group name with your information.

   ```
   $ aws scheduler create-schedule --name sqs-test-schedule --schedule-expression 'rate(5 minutes)' \
   --target '{"RoleArn": "ROLE_ARN", "Arn": "QUEUE_ARN", "Input": "TEST_PAYLOAD" }' \
   --group-name TestGroup
   --flexible-time-window '{ "Mode": "OFF"}'
   ```

------

 Your new schedule is now associated with the `TestGroup` schedule group. 

# Deleting a schedule group in EventBridge Scheduler
<a name="managing-schedule-group-delete"></a>

In the following, you can learn how to delete a schedule group using the AWS Management Console and the AWS Command Line Interface. When you delete a group, it is in the `DELETING` state until EventBridge Scheduler deletes all schedules in the group. After EventBridge Scheduler deletes the schedules in the group, the group is no longer available in your account. 

**Note**  
Once you create a group, you can't remove a schedule from that group, or associate the schedule with a different group. You can only associate a schedule with a group when you first create the schedule.

------
#### [ AWS Management Console ]

**To delete a group using the AWS Management Console**

1. Sign in to the AWS Management Console and open the Amazon EventBridge console at [https://console.aws.amazon.com/events/](https://console.aws.amazon.com/events/).

1. In the left navigation pane, choose **Schedule groups** in the left navigation pane. 

1. On the **Schedule groups** page, from the list of existing groups in the current AWS Region, locate the group you want to delete. If you don't see the group you're looking for, choose another AWS Region. 
**Note**  
 You can't delete, or edit, the **default** group. 

1. Select the check box for the group that you want to delete. 

1. Choose **Delete**. 

1. In the **Delete schedule group** dialog box, enter the name of the group to confirm your choice, then choose **Delete**. 

1. In the **Schedule groups** list, the **Status** column changes to indicate that your group is now **Deleting**. The group remains in this state until EventBridge Scheduler deletes all of the schedules associated with the group. 

1. To refresh the list and confirm that the group was deleted, choose the **Refresh** icon. 

------
#### [ AWS CLI ]

**To delete a group using the AWS CLI**

1. Open a new command prompt window.

1. From the AWS Command Line Interface (AWS CLI), enter the following[https://awscli.amazonaws.com/v2/documentation/api/latest/reference/scheduler/delete-schedule-group.html](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/scheduler/delete-schedule-group.html) command to delete the schedule group. Replace the value for `--name` with your information.

   ```
   $ aws scheduler delete-schedule-group --name TestGroup
   ```

    If successful, this AWS CLI operation doesn't return a response. 

1. To verify that the group is in the `DELETING` state, run the following [https://awscli.amazonaws.com/v2/documentation/api/latest/reference/scheduler/get-schedule-group.html](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/scheduler/get-schedule-group.html) command. 

   ```
   $ aws scheduler get-schedule-group --name TestGroup
   ```

    If successful, you receive output similar to the following: 

   ```
   {
       "Arn": "arn:aws::scheduler:us-west-2:123456789012:schedule-group/TestGroup",
       "CreationDate": "2023-01-01T09:00:00.000000-07:00",
       "LastModificationDate": "2023-01-01T09:00:00.000000-07:00",
       "Name": "TestGroup",
       "State": "DELETING"
   }
   ```

   EventBridge Scheduler deletes the group after it deletes the schedules associated with the group. If you run `get-schedule-group` again, you receive following `ResourceNotFoundException` response: 

   ```
   An error occurred (ResourceNotFoundException) when calling the GetScheduleGroup operation: Schedule group TestGroup does not exist.
   ```

------

## Related resources
<a name="managing-schedule-group-related-resources"></a>

 For more information on schedule groups, see the following resources: 
+ [CreateScheduleGroup](https://docs.aws.amazon.com/scheduler/latest/APIReference/API_CreateScheduleGroup.html) operation in the *EventBridge Scheduler API Reference*.
+ [DeleteScheduleGroup](https://docs.aws.amazon.com/scheduler/latest/APIReference/API_DeleteScheduleGroup.html) operation in the *EventBridge Scheduler API Reference*.