Skip to content

Ask about why I can't connect my EC2 Instance when I delpoy with codeDeploy.

0

Hi. I'm using t2 micro Ec2 with Ubuntu. I'm not using UFW. I connected EC2 to domain using route53.

Whenever I deploy my codes with CodeDeploy, I can't connect to my Ec2.(with SSH) Also when I try to access the domain, I can't get response. Deploy logs in CodeDeploy page say deployment succeeded. When I get restarted my EC2, I can access to Ec2 and accessing domain work. And deployed codes is there. In Ec2 page, Status check says my instance is fine. I need the idea why my instance get stuck.

Thx.

asked 2 years ago292 views
3 Answers
0

Hello.

Are you experiencing an increase in memory or CPU usage due to the load during deployment?
For example, if sshd stops due to such a load, SSH connections will not be possible.
Therefore, please check the system log to see if any errors occurred during the time when you were unable to connect.
Also, you may be able to connect using Session Manager instead of SSH, so please check that.
https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager.html

EXPERT
answered 2 years ago
0

Hi nag

The issue seems to be with your EC2 instance not starting properly after deployment with CodeDeploy.

Check these steps to resolve the issue:

Check Deployment Logs:

In the CodeDeploy dashboard, examine the deployment logs for any errors during startup. This might provide clues about the script issue.

Review Deployment Script:

Ensure the deployment script starts services and processes in the correct order. Verify ownership and permissions of deployed files.

Check System Logs:

Connect to the instance after a failed deployment (using a separate method if SSH fails) and check system logs (e.g., /var/log/syslog) for errors during startup.

Monitor Resource Usage:

Use the AWS CloudWatch console to monitor resource usage (CPU, memory) during deployment. If it spikes excessively, consider optimizing your deployment script or upgrading your instance type.

CodeDeploy Troubleshooting Guide: https://docs.aws.amazon.com/codedeploy/latest/userguide/troubleshooting.html

Amazon CloudWatch Documentation: https://docs.aws.amazon.com/cloudwatch/

EXPERT
answered 2 years ago
0

=>Here's a concise summary of steps to troubleshoot why your EC2 instance becomes inaccessible after deployment with CodeDeploy:

Security Group Settings: Ensure SSH (port 22) is open in the EC2 instance's security group to your IP address or range.

=>Network ACLs: Check subnet Network ACLs to ensure they allow necessary inbound/outbound traffic.

=>Route 53 and DNS: Verify Route 53 configuration is correct and DNS settings point to the EC2 instance's IP.

=>Instance Logs: Review EC2 instance logs (/var/log/syslog, /var/log/cloud-init.log) for networking errors.

=>CodeDeploy Logs: Check CodeDeploy logs to ensure deployment scripts complete without networking issues.

=>Instance Health Checks: Monitor EC2 instance status checks in AWS Management Console for underlying issues.

=>Testing Connectivity: After deployment, test accessing the EC2 instance via public IP to rule out DNS issues.

=>Instance Type and Capacity: Consider if t2.micro instance type is sufficient during deployment phases.

=>AWS Support: If issues persist, contact AWS Support for specialized assistance.

EXPERT
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.