:doc:`PaymentCryptographyControlPlane <../../payment-cryptography>` / Client / create_alias

************
create_alias
************



.. py:method:: PaymentCryptographyControlPlane.Client.create_alias(**kwargs)

  

  Creates an *alias*, or a friendly name, for an Amazon Web Services Payment Cryptography key. You can use an alias to identify a key in the console and when you call cryptographic operations such as `EncryptData <https://docs.aws.amazon.com/payment-cryptography/latest/DataAPIReference/API_EncryptData.html>`__ or `DecryptData <https://docs.aws.amazon.com/payment-cryptography/latest/DataAPIReference/API_DecryptData.html>`__.

   

  You can associate the alias with any key in the same Amazon Web Services Region. Each alias is associated with only one key at a time, but a key can have multiple aliases. You can't create an alias without a key. The alias must be unique in the account and Amazon Web Services Region, but you can create another alias with the same name in a different Amazon Web Services Region.

   

  To change the key that's associated with the alias, call `UpdateAlias <https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_UpdateAlias.html>`__. To delete the alias, call `DeleteAlias <https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_DeleteAlias.html>`__. These operations don't affect the underlying key. To get the alias that you created, call `ListAliases <https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_ListAliases.html>`__.

   

  **Cross-account use**: This operation can't be used across different Amazon Web Services accounts.

   

  **Related operations:**

   

  
  * `DeleteAlias <https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_DeleteAlias.html>`__
   
  * `GetAlias <https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_GetAlias.html>`__
   
  * `ListAliases <https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_ListAliases.html>`__
   
  * `UpdateAlias <https://docs.aws.amazon.com/payment-cryptography/latest/APIReference/API_UpdateAlias.html>`__
  

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/payment-cryptography-2021-09-14/CreateAlias>`_  


  **Request Syntax**
  ::

    response = client.create_alias(
        AliasName='string',
        KeyArn='string'
    )
    
  :type AliasName: string
  :param AliasName: **[REQUIRED]** 

    A friendly name that you can use to refer to a key. An alias must begin with ``alias/`` followed by a name, for example ``alias/ExampleAlias``. It can contain only alphanumeric characters, forward slashes (/), underscores (_), and dashes (-).

     

    .. warning::

       

      Don't include personal, confidential or sensitive information in this field. This field may be displayed in plaintext in CloudTrail logs and other output.

      

    

  
  :type KeyArn: string
  :param KeyArn: 

    The ``KeyARN`` of the key to associate with the alias.

    

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

    
    ::

      {
          'Alias': {
              'AliasName': 'string',
              'KeyArn': 'string'
          }
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **Alias** *(dict) --* 

        The alias for the key.

        
        

        - **AliasName** *(string) --* 

          A friendly name that you can use to refer to a key. The value must begin with ``alias/``.

           

          .. warning::

             

            Do not include confidential or sensitive information in this field. This field may be displayed in plaintext in CloudTrail logs and other output.

            

          
        

        - **KeyArn** *(string) --* 

          The ``KeyARN`` of the key associated with the alias.

          
    
  
  **Exceptions**
  
  *   :py:class:`PaymentCryptographyControlPlane.Client.exceptions.ServiceQuotaExceededException`

  
  *   :py:class:`PaymentCryptographyControlPlane.Client.exceptions.ServiceUnavailableException`

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

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

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

  
  *   :py:class:`PaymentCryptographyControlPlane.Client.exceptions.ResourceNotFoundException`

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

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

  