<p>My exposed service on <code>nodePort</code> seems to not allow traffic through it.</p>

<p>So how to add rules to allow traffic for that port range on <code>CLI</code> not on the console?
<a href="https://i.stack.imgur.com/4stuH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4stuH.png" alt="enter image description here"></a></p>

<h2><code>EC2</code> Security groups</h2>

<p>There is a <a href="https://us-west-1.console.aws.amazon.com/ec2/v2/home?region=us-west-1#SecurityGroups:" rel="nofollow noreferrer">security group</a> on your screen.</p>

<p>See more about security groups:</p>

<ul>
<li><p><a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-security-groups.html#security-group-rules" rel="nofollow noreferrer">EC2 Security Groups</a></p></li>
<li><p><a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-security-groups.html#creating-security-group" rel="nofollow noreferrer">Creating a Security Group</a></p></li>
</ul>

<h2><code>CLI</code> for <code>AWS Security groups</code></h2>

<p>As for <code>CLI</code> for working with <code>AWS Security groups</code>, see this article: <a href="https://docs.aws.amazon.com/cli/latest/userguide/cli-services-ec2-sg.html" rel="nofollow noreferrer">Creating, Configuring, and Deleting Security Groups for Amazon EC2 - AWS Command Line Interface</a></p>

<pre><code>$ aws ec2 create-security-group --group-name my-sg --description "My security group" --vpc-id vpc-1a2b3c4d
{
    "GroupId": "sg-903004f8"
}

$ aws ec2 authorize-security-group-ingress --group-id sg-903004f8 --protocol tcp --port 3389 --cidr 203.0.113.0/24
</code></pre>

<blockquote>
  <p>The following command adds another rule to enable SSH to instances in the same security group.</p>
</blockquote>

<pre><code>$ aws ec2 authorize-security-group-ingress --group-id sg-903004f8 --protocol tcp --port 22 --cidr 203.0.113.0/24
</code></pre>

<blockquote>
  <p>To view the changes to the security group, run the <a href="https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-security-groups.html" rel="nofollow noreferrer">describe-security-groups</a> command.</p>
</blockquote>

<pre><code>$ aws ec2 describe-security-groups --group-ids `sg-903004f8`
</code></pre>

<p>O/P is:</p>

<pre><code>{
    "SecurityGroups": [
        {
            "IpPermissionsEgress": [
                {
                    "IpProtocol": "-1",
                    "IpRanges": [
                        {
                            "CidrIp": "0.0.0.0/0"
                        }
                    ],
                    "UserIdGroupPairs": []
                }
            ],
            "Description": "My security group"
            "IpPermissions": [
                {
                    "ToPort": 22,
                    "IpProtocol": "tcp",
                    "IpRanges": [
                        {
                            "CidrIp": "203.0.113.0/24"
                        }
                    ]
                    "UserIdGroupPairs": [],
                    "FromPort": 22
                }
            ],
            "GroupName": "my-sg",
            "OwnerId": "123456789012",
            "GroupId": "sg-903004f8"
        }
    ]
}
</code></pre>

<h2>P.S. <code>awless.io</code> - A Mighty CLI for AWS</h2>

<p>There is also a bit outdated but still convenient <code>CLI</code> tool: 
<a href="https://github.com/wallix/awless" rel="nofollow noreferrer">wallix/awless: A Mighty CLI for AWS</a></p>

<blockquote>
  <p>A Mighty CLI for AWS <a href="http://awless.io/" rel="nofollow noreferrer">http://awless.io/</a></p>
</blockquote>

<p>Here the <a href="https://medium.com/@hbbio/awless-io-a-mighty-cli-for-aws-a0d48bdb59a4" rel="nofollow noreferrer">Medium post about it</a></p>
