Security Groups for AWS DMS - amazon-web-services

I am trying to setup DMS between my on-prem db and cloud. When I try to setup the cloud instance doesn't seem to have necessary privileges to connect to on-prem db. Should I add the security groups in AWS to DMS Replication Instance or Target Database?

This maybe of use to you, it is not directly an answer but it will help you to diagnose it.
You need a security group on both the replication instance and the target database.
You will need to have your replication instance in a security group that can reach both the source and target.
I would start by confirming that your replication instance can reach the on premise source. Fire up a small ec2 instance in the same security group as you replication instance and confirm you can ping and telnet to the on prem source. Make sure you use telnet on the correct port, a failure is ok so long as it doesn't hang. If it hangs you have a firewall or security group issue. Following the ping and telnet tests I would check the flowlogs and confirm you have Accepted traffic going both ways on the correct port.
If this is a success you should be able to create a source endpoint to your on premise Database. Any issue your at this point again check your Flowlogs. After that make sure your on premise DB will accept remote connections and the user you are connecting with has authority to do so.
The target database security group will need to allow in traffic from your replication instance on the correct port. I'm not sure if the ping test will work but the telnet should. Again look for traffic in your flow logs you want accepts in both directions.

Related

Securing AWS ECS Cluster

We are trying to create an ECS Cluster however we noticed that the internal ECS Agent is unable to register. We unblocked TCP 443 (ACL and SG) however it still did not register. We then proceeded to open up everything All Traffic both TCP and UDP and then the agent was able to register.
We tried to investigate what is being used using FlowLogs but it seems that the agent is using a random port and a different IP each time which makes it almost impossible for us to secure our network due to the agent. We tried and searched a lot for documentation about how and what the ECS Agent needs to run properly to no avail.
What we would like to achieve is to secure our network while allowing the agent to function as needed. Perhaps a better question would be which ports is the ecs-agent trying to use exactly and to which IPs should we allow that traffic to come from/go to?
From just 1 hour the flow log shows IPs from all over the world trying to hit the servers it just doesn't make sense not to prioritize this matter.
The ECS agent needs outgoing internet access to register itself to the cluster.
Here are some steps to try:
Check the security group on the EC2 instances to ensure they're
allowing outbound traffic.
Check your VPC config where the ECS instances are running and ensure they have internet access.
VPC Route Tables to ensure it's routing
destination 0.0.0.0/0 to your Internet Gateway.
Check your ACLs rules and ensure your outbound rules
match your inbound - which has bitten me a few times!

My aws instance is stuck and cannot connect usign ssh what should i do

My aws instance is stuck and cannot connect using ssh client what should i do?
My hosted websites are also not working. I do not want to restart my aws instance through aws console.
Please help me in this regard.
Thanks in advance.
A recommendation to troubleshoot these kinds of problems
Always generate logs.
Always use a Cloudwatch's agent to retrieve specific logs from your instances.
Check this link to learn more about it: https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/send_logs_to_cwl.html
About your problem
I think you tried to connect to it via SSH too many times without closing the previous connections.
Your instance is out of memory, for this situation you must restart your instance.
You could get the last screenshot of your instance using the options from Console.
Follow this link for more information about troubleshooting
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/TroubleshootingInstancesConnecting.html
Some suggestions from that link:
Check your security group rules. You need a security group rule that allows inbound traffic from your public IPv4 address on the proper port.
[EC2-VPC] Check the route table for the subnet. You need a route that sends all traffic destined outside the VPC to the internet gateway for the VPC.
[EC2-VPC] Check the network access control list (ACL) for the subnet. The network ACLs must allow inbound and outbound traffic from your local IP address on the proper port. The default network ACL allows all inbound and outbound traffic.
-If your computer is on a corporate network, ask your network administrator whether the internal firewall allows inbound and outbound traffic from your computer on port 22 (for Linux instances) or port 3389 (for Windows instances).
And more...
If the issue still continues, please create an AMI(image) of the instance and try to create a new instance from that AMI. Then try to SSH and everything went smooth the terminate the old instance.

Cannot access Amazon RDS instance

I have created a free-tier PostgreSQL RDS instance and everything appears to looks good on the portal. However, I am unable to get to the instance.
Going through the troubleshooting steps, they mention it could a firewall issue on my end. However, a quick ping from an external site reveals the same timeout issue.
Is there a step that I've missed?
Ping is typically disabled in AWS Security Groups. It is not recommended as a method of checking network connections.
The best method would be to use an SQL client to connect to the database via JDBC or ODBC.
Things to check:
Your RDS instance was launched as Publicly Accessible
Your RDS instance was launched in a Public Subnet (Definition: The subnet's Route Table points to an Internet Gateway)
The Security Group permits connections on the database port (this is also where you could permit PING access, but no guarantee that it would work with an RDS instance)
Check the associated Security Groups that you have tagged. Security groups hold the firewall rules. Either you may have to tweak the group that you have selected or try changing / modifying the group that you (or your profile) have access to.

How to connect to AWS elasticache?

Could someone give a step-by-step procedure for connecting to elasticache.
I'm trying to connect to a redis elasticache node from inside my EC2 instance (sshed in). I'm getting Connection Timed Out errors each time, and I can't figure out what's wrong with how I've configured my AWS settings.
They are in different VPCs, but in my elasticache VPC, I have a custom TCP inbound rule at port 6379 to accept from anywhere. And the two VPCs share an Active Peer connection that I set up. What more am I intended to do?
EDIT:
I am trying to connect via the redis-cli command. I sshed in because I was originally trying to connect via the node-redis module since my EC2 instance hosts a node server. So officially my two attempts are 1. A scripted module and 2. The redis-cli command provided in the AWS documentation.
As far as I can tell, I have also set up the route tables correctly according to this: http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Route_Tables.html#route-tables-vpc-peering
You cannot connect to Elasticache from outside its VPC. It's a weird design decision on AWS' part, and although it's not documented well, it is documented here:
Amazon ElastiCache Nodes, deployed within a VPC, can never be accessed from the Internet or from EC2 Instances outside the VPC.
You can set your security groups to allow connections from everywhere, and it will look like it worked, but it won't matter or let you actually connect from outside the VPC (also a weird design decision).
In your Redis cluster properties you have a reference to the Security Group. Copy it.
In our EC2 instance you also have a Security Group. You should edit this Security Group and add the ID of the Redis Security Group as CIDR in the outbound connections + the port 6379.
This way the two Security Groups are linked and the connection can be established.
Two things we might forget when trying to connect to ElasticCache,
Configuring inbound TCP rule to allow incoming requests on port 6379
Adding EC2 security group in ElasticCache instance
Second one helped me.
Reference to (2) : https://www.youtube.com/watch?v=fxjsxtcgDoc&ab_channel=HendyIrawanSocialEnterprise
Here is step-by-step instructions for connection to Redis Elasticache cluster from EC2 inctance located in the same VPC as Elasticache:
Connect to a Elasticache Redis Cluster's Node

Can't ping AWS RDS instance after allowing ICMP

I'm trying to ping my newly set up AWS RDS instance, but I am unable to do so (four "Request timed out" errors).
I added a rule in my EC2 security group for the instance, allowing all ICMP but it still does not work.
I am new to this, so apologies if I'm missing something obvious. Thanks!
Amazon Relational Database Service (Amazon RDS) is a web service that makes it easy to set up, operate, and scale a relational database in the cloud.
With that said, it is not a host that you can ping. In fact many instances of the database product could reside on one virtual machine; the infrastructure behind this is hidden from user.
EC2 security group should work, for EC2 server; are you pinging the EC2 instance correctly? The security rule should be setup as the picture here