[Yandex Cloud documentation](../../../index.md) > [Yandex Cloud Notification Service](../../index.md) > [Step-by-step guides](../index.md) > Topics > Creating a subscription to a topic

# Creating a subscription

{% list tabs group=instructions %}

- Management console {#console}

  1. In the [management console](https://console.yandex.cloud), select the folder containing the topic.
  1. Navigate to **Cloud Notification Service**.
  1. Select **Topics** on the left.
  
     1. Select a topic.
     1. Select **Subscriptions** on the left.
     1. Click **Create subscription**.
     1. Select a notification channel type:
          
        * **Mobile push notifications**.
        
            Enter the endpoint ARN in `arn:aws:sns::<cloud_id>:endpoint/<platform>/<channel_name>/<endpoint_unique_id>` format. You can copy the ARN on the endpoint’s settings page.
     
        * **In-browser push notifications**.
     
            Enter the endpoint ARN in `arn:aws:sns::<cloud_id>:endpoint/<platform>/<channel_name>/<endpoint_unique_id>` format.
        
        * **SMS**.
           
            Enter your phone number in [E.164](https://en.wikipedia.org/wiki/E.164) format, e.g., `+79991112233`. You do not need to pre-add the phone number to the SMS notification channel, but you need to create the channel itself.
     
     1. Click **Create subscription**.
     
        Subscribe other endpoints to the topic in the same way.

- AWS CLI {#aws-cli}

  1. If you do not have the AWS CLI yet, [install and configure it](../../../storage/tools/aws-cli.md).
  1. Run this command:

     ```bash
     aws sns subscribe \
       --topic-arn <topic_ARN> \
       --protocol <channel_type> \
       --notification-endpoint <endpoint_ARN_or_phone_number>
     ```
     
     Where:
       * `topic-arn`: Topic ARN.
       * `protocol`: Type of notification channel, e.g., `sms`, `application`.
       * `notification-endpoint`: ARN of the endpoint subscribing to the topic, in `arn:aws:sns::<cloud_id>:endpoint/<platform>/<channel_name>/<endpoint_unique_id>` format. For SMS, enter a phone number in [E.164](https://en.wikipedia.org/wiki/E.164) format, e.g., `+79991112233`.
     
     For more on the `aws sns subscribe` command, see [this AWS guide](https://docs.amazonaws.cn/en_us/sns/latest/dg/sns-create-subscribe-endpoint-to-topic.html).

- AWS SDK for Python {#python}

  1. If you do not have the AWS SDK for Python (boto3) yet, [install and configure it](../../tools/sdk-python.md#aws-sdk).
  1. Use the following code to subscribe an endpoint to notifications in a topic:
     
     ```python
     try:
         response = client.subscribe(
             TopicArn = "<topic_ARN>",
             Protocol = "<channel_type>",
             Endpoint = "<endpoint_ARN_or_phone_number>"
         )
         print(f"Topic ARN: {response['TopicArn']}")
     except botocore.exceptions.ClientError as error:
         print(f"Error: {error}")
     ```
     
     Where:
     
     * `TopicArn`: Topic ARN.
     * `Protocol`: Notification channel type, e.g., `sms` or `application`.
     * `Endpoint`: ARN of the endpoint subscribing to the topic, in `arn:aws:sns::<cloud_id>:endpoint/<platform>/<channel_name>/<endpoint_unique_id>` format. For SMS, enter a phone number in [E.164](https://en.wikipedia.org/wiki/E.164) format, e.g., `+79991112233`.

{% endlist %}