:doc:`MigrationHubRefactorSpaces <../../migration-hub-refactor-spaces>` / Client / create_service

**************
create_service
**************



.. py:method:: MigrationHubRefactorSpaces.Client.create_service(**kwargs)

  

  Creates an Amazon Web Services Migration Hub Refactor Spaces service. The account owner of the service is always the environment owner, regardless of which account in the environment creates the service. Services have either a URL endpoint in a virtual private cloud (VPC), or a Lambda function endpoint.

   

  .. warning::

     

    If an Amazon Web Services resource is launched in a service VPC, and you want it to be accessible to all of an environment’s services with VPCs and routes, apply the ``RefactorSpacesSecurityGroup`` to the resource. Alternatively, to add more cross-account constraints, apply your own security group.

    

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/migration-hub-refactor-spaces-2021-10-26/CreateService>`_  


  **Request Syntax**
  ::

    response = client.create_service(
        ApplicationIdentifier='string',
        ClientToken='string',
        Description='string',
        EndpointType='LAMBDA'|'URL',
        EnvironmentIdentifier='string',
        LambdaEndpoint={
            'Arn': 'string'
        },
        Name='string',
        Tags={
            'string': 'string'
        },
        UrlEndpoint={
            'HealthUrl': 'string',
            'Url': 'string'
        },
        VpcId='string'
    )
    
  :type ApplicationIdentifier: string
  :param ApplicationIdentifier: **[REQUIRED]** 

    The ID of the application which the service is created.

    

  
  :type ClientToken: string
  :param ClientToken: 

    A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.

    This field is autopopulated if not provided.

  
  :type Description: string
  :param Description: 

    The description of the service.

    

  
  :type EndpointType: string
  :param EndpointType: **[REQUIRED]** 

    The type of endpoint to use for the service. The type can be a URL in a VPC or an Lambda function.

    

  
  :type EnvironmentIdentifier: string
  :param EnvironmentIdentifier: **[REQUIRED]** 

    The ID of the environment in which the service is created.

    

  
  :type LambdaEndpoint: dict
  :param LambdaEndpoint: 

    The configuration for the Lambda endpoint type.

    

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

      The Amazon Resource Name (ARN) of the Lambda function or alias.

      

    
  
  :type Name: string
  :param Name: **[REQUIRED]** 

    The name of the service.

    

  
  :type Tags: dict
  :param Tags: 

    The tags to assign to the service. A tag is a label that you assign to an Amazon Web Services resource. Each tag consists of a key-value pair..

    

  
    - *(string) --* 

    
      - *(string) --* 

      


  :type UrlEndpoint: dict
  :param UrlEndpoint: 

    The configuration for the URL endpoint type. When creating a route to a service, Refactor Spaces automatically resolves the address in the ``UrlEndpointInput`` object URL when the Domain Name System (DNS) time-to-live (TTL) expires, or every 60 seconds for TTLs less than 60 seconds.

    

  
    - **HealthUrl** *(string) --* 

      The health check URL of the URL endpoint type. If the URL is a public endpoint, the ``HealthUrl`` must also be a public endpoint. If the URL is a private endpoint inside a virtual private cloud (VPC), the health URL must also be a private endpoint, and the host must be the same as the URL.

      

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

      The URL to route traffic to. The URL must be an `rfc3986-formatted URL <https://datatracker.ietf.org/doc/html/rfc3986>`__. If the host is a domain name, the name must be resolvable over the public internet. If the scheme is ``https``, the top level domain of the host must be listed in the `IANA root zone database <https://www.iana.org/domains/root/db>`__.

      

    
  
  :type VpcId: string
  :param VpcId: 

    The ID of the VPC.

    

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

    
    ::

      {
          'ApplicationId': 'string',
          'Arn': 'string',
          'CreatedByAccountId': 'string',
          'CreatedTime': datetime(2015, 1, 1),
          'Description': 'string',
          'EndpointType': 'LAMBDA'|'URL',
          'EnvironmentId': 'string',
          'LambdaEndpoint': {
              'Arn': 'string'
          },
          'LastUpdatedTime': datetime(2015, 1, 1),
          'Name': 'string',
          'OwnerAccountId': 'string',
          'ServiceId': 'string',
          'State': 'CREATING'|'ACTIVE'|'DELETING'|'FAILED',
          'Tags': {
              'string': 'string'
          },
          'UrlEndpoint': {
              'HealthUrl': 'string',
              'Url': 'string'
          },
          'VpcId': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **ApplicationId** *(string) --* 

        The ID of the application that the created service belongs to.

        
      

      - **Arn** *(string) --* 

        The Amazon Resource Name (ARN) of the service.

        
      

      - **CreatedByAccountId** *(string) --* 

        The Amazon Web Services account ID of the service creator.

        
      

      - **CreatedTime** *(datetime) --* 

        A timestamp that indicates when the service is created.

        
      

      - **Description** *(string) --* 

        The description of the created service.

        
      

      - **EndpointType** *(string) --* 

        The endpoint type of the service.

        
      

      - **EnvironmentId** *(string) --* 

        The unique identifier of the environment.

        
      

      - **LambdaEndpoint** *(dict) --* 

        The configuration for the Lambda endpoint type.

        
        

        - **Arn** *(string) --* 

          The Amazon Resource Name (ARN) of the Lambda function or alias.

          
    
      

      - **LastUpdatedTime** *(datetime) --* 

        A timestamp that indicates when the service was last updated.

        
      

      - **Name** *(string) --* 

        The name of the service.

        
      

      - **OwnerAccountId** *(string) --* 

        The Amazon Web Services account ID of the service owner.

        
      

      - **ServiceId** *(string) --* 

        The unique identifier of the service.

        
      

      - **State** *(string) --* 

        The current state of the service.

        
      

      - **Tags** *(dict) --* 

        The tags assigned to the created service. A tag is a label that you assign to an Amazon Web Services resource. Each tag consists of a key-value pair..

        
        

        - *(string) --* 
          

          - *(string) --* 
    
  
      

      - **UrlEndpoint** *(dict) --* 

        The configuration for the URL endpoint type.

        
        

        - **HealthUrl** *(string) --* 

          The health check URL of the URL endpoint type. If the URL is a public endpoint, the ``HealthUrl`` must also be a public endpoint. If the URL is a private endpoint inside a virtual private cloud (VPC), the health URL must also be a private endpoint, and the host must be the same as the URL.

          
        

        - **Url** *(string) --* 

          The URL to route traffic to. The URL must be an `rfc3986-formatted URL <https://datatracker.ietf.org/doc/html/rfc3986>`__. If the host is a domain name, the name must be resolvable over the public internet. If the scheme is ``https``, the top level domain of the host must be listed in the `IANA root zone database <https://www.iana.org/domains/root/db>`__.

          
    
      

      - **VpcId** *(string) --* 

        The ID of the VPC.

        
  
  **Exceptions**
  
  *   :py:class:`MigrationHubRefactorSpaces.Client.exceptions.ResourceNotFoundException`

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

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

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

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

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

  
  *   :py:class:`MigrationHubRefactorSpaces.Client.exceptions.AccessDeniedException`

  