:doc:`CloudWatchNetworkMonitor <../../networkmonitor>` / Client / create_monitor

**************
create_monitor
**************



.. py:method:: CloudWatchNetworkMonitor.Client.create_monitor(**kwargs)

  

  Creates a monitor between a source subnet and destination IP address. Within a monitor you'll create one or more probes that monitor network traffic between your source Amazon Web Services VPC subnets and your destination IP addresses. Each probe then aggregates and sends metrics to Amazon CloudWatch.

   

  You can also create a monitor with probes using this command. For each probe, you define the following:

   

  
  * ``source``—The subnet IDs where the probes will be created.
   
  * ``destination``— The target destination IP address for the probe.
   
  * ``destinationPort``—Required only if the protocol is ``TCP``.
   
  * ``protocol``—The communication protocol between the source and destination. This will be either ``TCP`` or ``ICMP``.
   
  * ``packetSize``—The size of the packets. This must be a number between ``56`` and ``8500``.
   
  * (Optional) ``tags`` —Key-value pairs created and assigned to the probe.
  

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/networkmonitor-2023-08-01/CreateMonitor>`_  


  **Request Syntax**
  ::

    response = client.create_monitor(
        monitorName='string',
        probes=[
            {
                'sourceArn': 'string',
                'destination': 'string',
                'destinationPort': 123,
                'protocol': 'TCP'|'ICMP',
                'packetSize': 123,
                'probeTags': {
                    'string': 'string'
                }
            },
        ],
        aggregationPeriod=123,
        clientToken='string',
        tags={
            'string': 'string'
        }
    )
    
  :type monitorName: string
  :param monitorName: **[REQUIRED]** 

    The name identifying the monitor. It can contain only letters, underscores (_), or dashes (-), and can be up to 200 characters.

    

  
  :type probes: list
  :param probes: 

    Displays a list of all of the probes created for a monitor.

    

  
    - *(dict) --* 

      Creates a monitor probe.

      

    
      - **sourceArn** *(string) --* **[REQUIRED]** 

        The ARN of the subnet.

        

      
      - **destination** *(string) --* **[REQUIRED]** 

        The destination IP address. This must be either ``IPV4`` or ``IPV6``.

        

      
      - **destinationPort** *(integer) --* 

        The port associated with the ``destination``. This is required only if the ``protocol`` is ``TCP`` and must be a number between ``1`` and ``65536``.

        

      
      - **protocol** *(string) --* **[REQUIRED]** 

        The protocol used for the network traffic between the ``source`` and ``destination``. This must be either ``TCP`` or ``ICMP``.

        

      
      - **packetSize** *(integer) --* 

        The size of the packets sent between the source and destination. This must be a number between ``56`` and ``8500``.

        

      
      - **probeTags** *(dict) --* 

        The list of key-value pairs created and assigned to the monitor.

        

      
        - *(string) --* 

        
          - *(string) --* 

          
    
  
    

  :type aggregationPeriod: integer
  :param aggregationPeriod: 

    The time, in seconds, that metrics are aggregated and sent to Amazon CloudWatch. Valid values are either ``30`` or ``60``. ``60`` is the default if no period is chosen.

    

  
  :type clientToken: string
  :param clientToken: 

    Unique, case-sensitive identifier to ensure the idempotency of the request. Only returned if a client token was provided in the request.

    This field is autopopulated if not provided.

  
  :type tags: dict
  :param tags: 

    The list of key-value pairs created and assigned to the monitor.

    

  
    - *(string) --* 

    
      - *(string) --* 

      


  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'monitorArn': 'string',
          'monitorName': 'string',
          'state': 'PENDING'|'ACTIVE'|'INACTIVE'|'ERROR'|'DELETING',
          'aggregationPeriod': 123,
          'tags': {
              'string': 'string'
          }
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **monitorArn** *(string) --* 

        The ARN of the monitor.

        
      

      - **monitorName** *(string) --* 

        The name of the monitor.

        
      

      - **state** *(string) --* 

        The state of the monitor.

        
      

      - **aggregationPeriod** *(integer) --* 

        The number of seconds that metrics are aggregated by and sent to Amazon CloudWatch. This will be either ``30`` or ``60``.

        
      

      - **tags** *(dict) --* 

        The list of key-value pairs assigned to the monitor.

        
        

        - *(string) --* 
          

          - *(string) --* 
    
  
  
  **Exceptions**
  
  *   :py:class:`CloudWatchNetworkMonitor.Client.exceptions.AccessDeniedException`

  
  *   :py:class:`CloudWatchNetworkMonitor.Client.exceptions.ThrottlingException`

  
  *   :py:class:`CloudWatchNetworkMonitor.Client.exceptions.ValidationException`

  
  *   :py:class:`CloudWatchNetworkMonitor.Client.exceptions.InternalServerException`

  
  *   :py:class:`CloudWatchNetworkMonitor.Client.exceptions.ConflictException`

  
  *   :py:class:`CloudWatchNetworkMonitor.Client.exceptions.ServiceQuotaExceededException`

  