> ## Documentation Index
> Fetch the complete documentation index at: https://cloudanix.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Security Group Name Prefixed With launch-wizard Should Not Be Used

### More Info:

EC2 security groups prefixed with launch-wizard should not be in use in order to follow AWS security best practices.

### Risk Level

Low

### Address

Security

### Compliance Standards

CBP

### Triage and Remediation

<Tabs>
  <Tab title="Remediation">
    ### Remediation

    <AccordionGroup>
      <Accordion title="Using Console" defaultOpen="true">
        Here are the step by step instructions to remediate the "Security Group Name Prefixed With launch-wizard Should Not Be Used" misconfiguration in AWS using the AWS console:

        1. Log in to the AWS Management Console.
        2. Go to the EC2 Dashboard.
        3. Click on the "Security Groups" option in the left-hand menu.
        4. Identify the security group(s) that have a name prefixed with "launch-wizard".
        5. Select the security group(s) that need to be remediated.
        6. Click on the "Actions" button, and then select "Edit Group Name".
        7. Rename the security group(s) to a more descriptive and meaningful name that does not include the "launch-wizard" prefix.
        8. Click on the "Save" button to save the changes.

        Once you have completed these steps, the security group(s) will no longer have a name prefixed with "launch-wizard", and the misconfiguration will be remediated.

        #
      </Accordion>

      <Accordion title="Using CLI">
        To remediate the misconfiguration "Security Group Name Prefixed With launch-wizard Should Not Be Used" for AWS using AWS CLI, follow these steps:

        1. Open the AWS CLI on your local machine or on the AWS EC2 instance.

        2. Run the following command to list all the security groups in your account:

           ```
           aws ec2 describe-security-groups
           ```

        3. Identify the security group that has a name prefixed with "launch-wizard".

        4. Run the following command to rename the security group:

           ```
           aws ec2 update-security-group-name --group-id <security-group-id> --group-name <new-security-group-name>
           ```

           Replace `<security-group-id>` with the ID of the security group that you want to rename, and `<new-security-group-name>` with a new name for the security group that does not have "launch-wizard" prefix.

           For example:

           ```
           aws ec2 update-security-group-name --group-id sg-0123456789abcdef0 --group-name my-security-group
           ```

        5. Verify that the security group has been renamed successfully by running the following command:

           ```
           aws ec2 describe-security-groups --group-ids <security-group-id>
           ```

           Replace `<security-group-id>` with the ID of the security group that you have renamed.

           The output should show the new name of the security group.
      </Accordion>

      <Accordion title="Using Python">
        To remediate the security group name prefixed with `launch-wizard` in AWS using Python, you can follow the below steps:

        1. Import the required modules:

        ```python theme={null}
        import boto3
        ```

        2. Connect to the AWS account:

        ```python theme={null}
        client = boto3.client('ec2')
        ```

        3. Get all the security groups:

        ```python theme={null}
        response = client.describe_security_groups()
        ```

        4. Loop through all the security groups and check if the name is prefixed with `launch-wizard`:

        ```python theme={null}
        for sg in response['SecurityGroups']:
            if sg['GroupName'].startswith('launch-wizard'):
                # Delete the security group
                client.delete_security_group(GroupId=sg['GroupId'])
        ```

        5. The above code will delete all the security groups that have a name prefixed with `launch-wizard`. If you want to rename the security group, you can use the below code:

        ```python theme={null}
        for sg in response['SecurityGroups']:
            if sg['GroupName'].startswith('launch-wizard'):
                new_name = sg['GroupName'].replace('launch-wizard', 'new-name')
                # Rename the security group
                client.update_security_group_name_description(GroupId=sg['GroupId'], GroupName=new_name, Description='New Description')
        ```

        6. The above code will rename all the security groups that have a name prefixed with `launch-wizard` to `new-name`. You can also update the description of the security group as per your requirement.

        Note: Before deleting or renaming the security group, make sure that it is not being used by any instances or services.
      </Accordion>
    </AccordionGroup>
  </Tab>
</Tabs>

### Additional Reading:

* [https://docs.aws.amazon.com/launchwizard/latest/userguide/launch-wizard-sap-security-groups.html](https://docs.aws.amazon.com/launchwizard/latest/userguide/launch-wizard-sap-security-groups.html)
