# Add an EC2 node for debuging/testing

Author: Xuecheng Zhang

Freshness: 2021/11/25

We can add an EC2 node to join into an exsting EKS cluster but without workloads scheduled for debuging or testing. this EC2 node should be:

- In the same VPC of the EKS worker nodes.

- In the same Security Group of the EKS worker nodes.

- With the same IAM role as the EKS worker nodes.

- With Session Manager enabled.

As we want to add an EC2 node for the `staging-us-east-1-s01` EKS cluster, we can achieve it by following these steps in AWS Management Console:

1. Find any one of the three Auto Scaling groups for the `staging-us-east-1-s01` EKS cluster under [EC2 > Auto Scaling groups](https://console.aws.amazon.com/ec2autoscaling/home?region=us-east-1#/details), `staging-us-east-1-s01-us-east-1a-9233ea92-NodeGroup-139UDVEF691V8` was choosed for this example.

2. Choose any one of instances for the ASG under [`Instance management`](https://console.aws.amazon.com/ec2autoscaling/home?region=us-east-1#/details/staging-us-east-1-s01-us-east-1a-9233ea92-NodeGroup-139UDVEF691V8?view=instanceManagement) and open the instance details page, `i-04cdd78a82ce4c52a` as the instance ID for this example.

3. Find the `VPC ID` and `Subnet ID` for the instance in the `Instance summary` section, `vpc-01797c91977e12ca8` as the `VPC ID` and `subnet-02d16a0fac50ce196` as the `Subnet ID` in this example; Find the `Security group ID` for the instance in the `Security` tab, `sg-00bb91dd0246e1304` as the `Security group ID` in this example.

4. Launch an EC2 node via [LaunchInstanceWizard](https://console.aws.amazon.com/ec2/v2/home?region=us-east-1#LaunchInstanceWizard) with the following fields set/selected:

    - Choose an AMI from `Amazon Linux 2` or `Ubuntu Server` which with Session Manager agent pre-installed in `1. Choose AMI` step, `Ubuntu Server 20.04 LTS` was choosed in this example.

    - Choose the previous `VPC ID` (`vpc-01797c91977e12ca8` in this example) for `Network` and `Subnet ID` (`subnet-02d16a0fac50ce196` in this example) for `Subnet` in `3. Configure Instance` step.

    - Choose the IAM role with the `${EKS-cluster-name}-worker-profile-${random-suffix}` for `IAM role` in `3. Configure Instance` step, `staging-us-east-1-s01-worker-profile-8750cd9` was choosed in this example.

    - Choose the previous `Security group ID` (`sg-00bb91dd0246e1304` in this example) in `6. Configure Security Group` step.

5. Launch the node with `Proceed without a key pair` in the last step as we can use SSM to connect to the node.
