In order for the containers to communicate through ssh, it is important for ssh daemons to be started in all containers during their launch. However, in accordance to the safe security practices - We use the AWS Secrets Manager to inject the values into the container during run time AWS Secrets Manager w/ ECS.
In this step,
ssh-keygen -t rsa -f ssh_host_rsa_key -N ''
This step will create a public and a private key in the current folder
ubuntu@ip-172-31-9-117:~/scratch/temp_secrets$ ls -lrt ssh*
-rw-r--r-- 1 ubuntu ubuntu 404 Aug 22 18:56 ssh_host_rsa_key.pub
-rw------- 1 ubuntu ubuntu 1675 Aug 22 18:56 ssh_host_rsa_key
cat ssh_host_rsa_key | base64 | tr -d \\n
cat ssh_host_rsa_key.pub | base64 | tr -d \\n
The newline characters will be stripped in the output and carefully select the portion of the string till the start of the next command prompt
Edit the inbound and outbound rules of the security group to permit All Traffic, All Protocols, All Ports from the source as the “same” security group. Though this seems obvious, it is essential to permit the instances to communicate with each other other than TCP.
Inbound Rules Modification
Outbound Rules Modification