AdamDynamic
AdamDynamic

Reputation: 791

Configuring AWS Security Groups - what settings to run a simple script in EC2 instance, reading RDS

This is no doubt covered in the documentation somewhere, I'm not a developer though and reading the AWS documentation feels like drinking from a fire hose. I'm hoping someone here can point me in the right direction.

For my project I want to:

So far I have set up:

My question: How do I configure the security group I've created so that I'm able to do these things (without just exposing the instance and database to "all traffic")

The current settings of the security group (based on what tutorials I've made sense of) are:

Inbound (sensitive values changed):

Type         Protocol  Port-Range Source
All TCP      TCP       0-65535    sg-1234566 (launch-wizard)
SSH          TCP       22         100.0.0.1/31
All UDP      UDP       0-65535    sg-1234566 (launch-wizard)
All ICMP     All       N/A        sg-1234566 (launch-wizard)

Outbound:

Type         Protocol  Port-Range Source
All traffic  All       All        0.0.0.0/0

The SSH works and I've ran the commands to run phpMyAdmin on the instance, when I navigate to 100.0.0.1/phpmyadmin (not the actual public IP address) the connection just times out though. Happy to work through an online tutorial if anyone can suggest a good one that I might have missed.

Upvotes: 0

Views: 204

Answers (1)

AdamDynamic
AdamDynamic

Reputation: 791

For anyone's future reference, I managed to get a helpful response over on the AWS forums, I just needed to make sure that both my EC2 instance and my RDS database were both in the same security group and amend the inbound rules to accept HTTP:

Listening Ports:

MySQL -> 3306/TCP
SSH -> 22/TCP
phpMyAdmin -> 80/TCP

Source:

100.0.0.1/31 (this is where the client program is located)

Here is how I think your security group should look like

Inbound (sensitive values changed):

Type         Protocol  Port-Range Source
SSH          TCP       22         100.0.0.1/31
HTTP         TCP       80         100.0.0.1/31
MySQL/Aurora      TCP       3306    sg-1234566 (launch-wizard) ---> This one is included in below rule, will leave it in case you want to remove the below rule.
All TCP      TCP       0-65535    sg-1234566 (launch-wizard)
All UDP      UDP       0-65535    sg-1234566 (launch-wizard)
All ICMP     All       N/A        sg-1234566 (launch-wizard)

Outbound:

Type         Protocol  Port-Range Source
All traffic  All       All        0.0.0.0/0

Upvotes: 0

Related Questions