Introduction to security groups in AWS
What are Security groups in AWS?
The Security groups are the fundamentals of network security in AWS.
Basically, they control how traffics is allowed into or out of your EC2 instances.
By using security groups we can set allow rules(can be referenced by IP or by another security group) in AWS, so here we can configure which things should be allowed for the specific instances.
In simple terms, we can say the security groups work as a "firewall" for your EC2 instance.
Sample Image of Seciryr Group:
What is the inbound and outbound rule?
The Inbound rules are the rules that allow connectivity from the outside into the EC2 instance.
Here we mostly configure SSH, HTTP, and HTTPS (to allow access to your site from a browser URL)rules.
Things to know:
1) One Security group can be attached to multiple ec2 instances
2) One EC2 instance can have multiple security groups attached
3) Seciruty group Limited to a region or VPC combination
In case you switch the region or create a new VPC then you have to create a new security group for it.
4) All inbound traffic is blocked by default
5) All outbound traffic is Authorized by default
Some Advice:
It's good to maintain one separate security group for SSH access.
Troubleshooting:
If your application is not accessible or returning time out the issue then, most probably it's a security group issue.
In this situation, go to your security group configaution and verify if is it properly configured or not.
Some common PORTS to Know:
22 -> SSH(Secure shell) - Will allow you to log in to your Linux instances
21 -> FTP (File Transfer Protocol) - Upload files into your server using some client like Filezilla
22 -> SFTP(Secure File Transfer Protocol) - Upload file using SSH
80 -> HTTP - access unsecurd websites
443 -> HTTPS - Access secured websites
3389 -> RDP(Remote Desktop Protocol) - Allow login to windows instance