> ## 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.

# Redshift Reserved Node Should Not Have Status - Payment Pending

### More Info:

Ensure that none of your AWS Redshift Reserved Node purchases are pending.

### Risk Level

Low

### Address

Cost Optimisation

### Compliance Standards

CBP

### Triage and Remediation

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

    <AccordionGroup>
      <Accordion title="Using Console" defaultOpen="true">
        To remediate the issue of a Redshift Reserved Node having a status of "Payment Pending" in AWS, you can follow these steps using the AWS Management Console:

        1. **Navigate to the Redshift Console**: Go to the AWS Management Console and navigate to the Amazon Redshift service.

        2. **Identify the Reserved Node**: In the Redshift console, select the "Clusters" option from the left-hand menu. Identify the Redshift cluster that has the Reserved Node with the status of "Payment Pending".

        3. **Check Reserved Nodes**: In the cluster details page, navigate to the "Reserved Nodes" tab to view the list of Reserved Nodes associated with the cluster.

        4. **Identify the Payment Pending Node**: Look for the Reserved Node that has a status of "Payment Pending".

        5. **Modify the Reserved Node**: Select the Reserved Node with the "Payment Pending" status and choose the "Modify" option.

        6. **Complete the Payment**: Follow the prompts to complete the payment for the Reserved Node. Ensure that the payment method associated with your AWS account has sufficient funds or is valid for payment.

        7. **Confirm the Status Change**: Once the payment is completed successfully, the status of the Reserved Node should change from "Payment Pending" to "Active" or "Payment Complete".

        8. **Verify the Status**: Go back to the list of Reserved Nodes associated with the cluster and verify that the status of the Reserved Node has been updated.

        By following these steps, you should be able to remediate the issue of a Redshift Reserved Node having a status of "Payment Pending" in AWS using the AWS Management Console.

        #
      </Accordion>

      <Accordion title="Using CLI">
        To remediate the misconfiguration of a Redshift Reserved Node having the status "Payment Pending" in AWS using AWS CLI, you can follow these steps:

        1. List the Redshift Reserved Nodes to identify the one with the status "Payment Pending":

        ```bash theme={null}
        aws redshift describe-reserved-nodes --query "ReservedNodes[?State=='payment-pending']"
        ```

        2. Identify the Reserved Node ID of the node with the status "Payment Pending".

        3. Modify the Reserved Node to change the payment status to "active" using the following command:

        ```bash theme={null}
        aws redshift modify-reserved-node --reserved-node-id <ReservedNodeID> --reserved-node-offering-id <ReservedNodeOfferingID> --target-reserved-node-offering-id <NewReservedNodeOfferingID>
        ```

        Replace `<ReservedNodeID>`, `<ReservedNodeOfferingID>`, and `<NewReservedNodeOfferingID>` with the actual values of the Reserved Node ID, the current Reserved Node Offering ID, and the new Reserved Node Offering ID respectively.

        4. Check the status of the Reserved Node to ensure it has been updated successfully:

        ```bash theme={null}
        aws redshift describe-reserved-nodes --reserved-node-id <ReservedNodeID> --query "ReservedNodes[*].[ReservedNodeOfferingType,State]"
        ```

        After following these steps, the Redshift Reserved Node should no longer have the status "Payment Pending" and should be active.
      </Accordion>

      <Accordion title="Using Python">
        To remediate the misconfiguration of a Redshift Reserved Node having a status of "Payment Pending" in AWS using Python, you can follow these steps:

        1. Install the Boto3 library:

        ```bash theme={null}
        pip install boto3
        ```

        2. Use the following Python script to check the status of the Redshift Reserved Nodes and modify the status if it is "Payment Pending":

        ```python theme={null}
        import boto3

        def remediate_redshift_reserved_node():
            redshift = boto3.client('redshift')

            # Describe reserved nodes
            response = redshift.describe_reserved_nodes()

            for node in response['ReservedNodes']:
                if node['State'] == 'payment-pending':
                    # Modify the status to active
                    redshift.modify_reserved_node(
                        ReservedNodeId=node['ReservedNodeId'],
                        ReservedNodeOfferingType=node['ReservedNodeOfferingType'],
                        TargetReservedNodeOfferingId=node['TargetReservedNodeOfferingId']
                    )
                    print(f"Reserved Node {node['ReservedNodeId']} status has been remediated.")
                else:
                    print(f"Reserved Node {node['ReservedNodeId']} does not have a status of 'Payment Pending'.")

        if __name__ == '__main__':
            remediate_redshift_reserved_node()
        ```

        3. Run the Python script, and it will check the status of all the Redshift Reserved Nodes. If it finds any node with a status of "Payment Pending", it will modify the status to "Active".

        This script will help you automate the process of remediating Redshift Reserved Nodes with a status of "Payment Pending" in AWS using Python and the Boto3 library.
      </Accordion>
    </AccordionGroup>
  </Tab>
</Tabs>

### Additional Reading:

* [https://docs.aws.amazon.com/redshift/latest/mgmt/purchase-reserved-node-instance.html](https://docs.aws.amazon.com/redshift/latest/mgmt/purchase-reserved-node-instance.html)
