:doc:`Image <index>` / Action / modify_attribute

****************
modify_attribute
****************



.. py:method:: EC2.Image.modify_attribute(**kwargs)

  

  Modifies the specified attribute of the specified AMI. You can specify only one attribute at a time.

   

  To specify the attribute, you can use the ``Attribute`` parameter, or one of the following parameters: ``Description``, ``ImdsSupport``, or ``LaunchPermission``.

   

  Images with an Amazon Web Services Marketplace product code cannot be made public.

   

  To enable the SriovNetSupport enhanced networking attribute of an image, enable SriovNetSupport on an instance and create an AMI from the instance.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ModifyImageAttribute>`_  


  **Request Syntax**
  ::

    response = image.modify_attribute(
        Attribute='string',
        Description={
            'Value': 'string'
        },
        LaunchPermission={
            'Add': [
                {
                    'OrganizationArn': 'string',
                    'OrganizationalUnitArn': 'string',
                    'UserId': 'string',
                    'Group': 'all'
                },
            ],
            'Remove': [
                {
                    'OrganizationArn': 'string',
                    'OrganizationalUnitArn': 'string',
                    'UserId': 'string',
                    'Group': 'all'
                },
            ]
        },
        OperationType='add'|'remove',
        ProductCodes=[
            'string',
        ],
        UserGroups=[
            'string',
        ],
        UserIds=[
            'string',
        ],
        Value='string',
        OrganizationArns=[
            'string',
        ],
        OrganizationalUnitArns=[
            'string',
        ],
        ImdsSupport={
            'Value': 'string'
        },
        DryRun=True|False
    )
    
  :type Attribute: string
  :param Attribute: 

    The name of the attribute to modify.

     

    Valid values: ``description`` | ``imdsSupport`` | ``launchPermission``

    

  
  :type Description: dict
  :param Description: 

    A new description for the AMI.

    

  
    - **Value** *(string) --* 

      The attribute value. The value is case-sensitive.

      

    
  
  :type LaunchPermission: dict
  :param LaunchPermission: 

    A new launch permission for the AMI.

    

  
    - **Add** *(list) --* 

      The Amazon Web Services account ID, organization ARN, or OU ARN to add to the list of launch permissions for the AMI.

      

    
      - *(dict) --* 

        Describes a launch permission.

        

      
        - **OrganizationArn** *(string) --* 

          The Amazon Resource Name (ARN) of an organization.

          

        
        - **OrganizationalUnitArn** *(string) --* 

          The Amazon Resource Name (ARN) of an organizational unit (OU).

          

        
        - **UserId** *(string) --* 

          The Amazon Web Services account ID.

           

          Constraints: Up to 10 000 account IDs can be specified in a single request.

          

        
        - **Group** *(string) --* 

          The name of the group.

          

        
      
  
    - **Remove** *(list) --* 

      The Amazon Web Services account ID, organization ARN, or OU ARN to remove from the list of launch permissions for the AMI.

      

    
      - *(dict) --* 

        Describes a launch permission.

        

      
        - **OrganizationArn** *(string) --* 

          The Amazon Resource Name (ARN) of an organization.

          

        
        - **OrganizationalUnitArn** *(string) --* 

          The Amazon Resource Name (ARN) of an organizational unit (OU).

          

        
        - **UserId** *(string) --* 

          The Amazon Web Services account ID.

           

          Constraints: Up to 10 000 account IDs can be specified in a single request.

          

        
        - **Group** *(string) --* 

          The name of the group.

          

        
      
  
  
  :type OperationType: string
  :param OperationType: 

    The operation type. This parameter can be used only when the ``Attribute`` parameter is ``launchPermission``.

    

  
  :type ProductCodes: list
  :param ProductCodes: 

    Not supported.

    

  
    - *(string) --* 

    

  :type UserGroups: list
  :param UserGroups: 

    The user groups. This parameter can be used only when the ``Attribute`` parameter is ``launchPermission``.

    

  
    - *(string) --* 

    

  :type UserIds: list
  :param UserIds: 

    The Amazon Web Services account IDs. This parameter can be used only when the ``Attribute`` parameter is ``launchPermission``.

    

  
    - *(string) --* 

    

  :type Value: string
  :param Value: 

    The value of the attribute being modified. This parameter can be used only when the ``Attribute`` parameter is ``description`` or ``imdsSupport``.

    

  
  :type OrganizationArns: list
  :param OrganizationArns: 

    The Amazon Resource Name (ARN) of an organization. This parameter can be used only when the ``Attribute`` parameter is ``launchPermission``.

    

  
    - *(string) --* 

    

  :type OrganizationalUnitArns: list
  :param OrganizationalUnitArns: 

    The Amazon Resource Name (ARN) of an organizational unit (OU). This parameter can be used only when the ``Attribute`` parameter is ``launchPermission``.

    

  
    - *(string) --* 

    

  :type ImdsSupport: dict
  :param ImdsSupport: 

    Set to ``v2.0`` to indicate that IMDSv2 is specified in the AMI. Instances launched from this AMI will have ``HttpTokens`` automatically set to ``required`` so that, by default, the instance requires that IMDSv2 is used when requesting instance metadata. In addition, ``HttpPutResponseHopLimit`` is set to ``2``. For more information, see `Configure the AMI <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-IMDS-new-instances.html#configure-IMDS-new-instances-ami-configuration>`__ in the *Amazon EC2 User Guide*.

     

    .. warning::

       

      Do not use this parameter unless your AMI software supports IMDSv2. After you set the value to ``v2.0``, you can't undo it. The only way to “reset” your AMI is to create a new AMI from the underlying snapshot.

      

    

  
    - **Value** *(string) --* 

      The attribute value. The value is case-sensitive.

      

    
  
  :type DryRun: boolean
  :param DryRun: 

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is ``DryRunOperation``. Otherwise, it is ``UnauthorizedOperation``.

    

  
  
  :returns: None