:doc:`EFS <../../efs>` / Client / modify_mount_target_security_groups

***********************************
modify_mount_target_security_groups
***********************************



.. py:method:: EFS.Client.modify_mount_target_security_groups(**kwargs)

  

  Modifies the set of security groups in effect for a mount target.

   

  When you create a mount target, Amazon EFS also creates a new network interface. For more information, see  CreateMountTarget. This operation replaces the security groups in effect for the network interface associated with a mount target, with the ``SecurityGroups`` provided in the request. This operation requires that the network interface of the mount target has been created and the lifecycle state of the mount target is not ``deleted``.

   

  The operation requires permissions for the following actions:

   

  
  * ``elasticfilesystem:ModifyMountTargetSecurityGroups`` action on the mount target's file system.
   
  * ``ec2:ModifyNetworkInterfaceAttribute`` action on the mount target's network interface.
  

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/elasticfilesystem-2015-02-01/ModifyMountTargetSecurityGroups>`_  


  **Request Syntax**
  ::

    response = client.modify_mount_target_security_groups(
        MountTargetId='string',
        SecurityGroups=[
            'string',
        ]
    )
    
  :type MountTargetId: string
  :param MountTargetId: **[REQUIRED]** 

    The ID of the mount target whose security groups you want to modify.

    

  
  :type SecurityGroups: list
  :param SecurityGroups: 

    An array of VPC security group IDs.

    

  
    - *(string) --* 

    

  
  :returns: None
  **Exceptions**
  
  *   :py:class:`EFS.Client.exceptions.BadRequest`

  
  *   :py:class:`EFS.Client.exceptions.InternalServerError`

  
  *   :py:class:`EFS.Client.exceptions.MountTargetNotFound`

  
  *   :py:class:`EFS.Client.exceptions.IncorrectMountTargetState`

  
  *   :py:class:`EFS.Client.exceptions.SecurityGroupLimitExceeded`

  
  *   :py:class:`EFS.Client.exceptions.SecurityGroupNotFound`

  

  **Examples**

  This operation modifies the security groups associated with a mount target for a file system.
  ::

    response = client.modify_mount_target_security_groups(
        MountTargetId='fsmt-12340abc',
        SecurityGroups=[
            'sg-abcd1234',
        ],
    )
    
    print(response)

  
  Expected Output:
  ::

    {
        'ResponseMetadata': {
            '...': '...',
        },
    }

  