Unable to create Inbound rule

0

I'm using powershell to create inbound IP rules for an EC2 Instance sec group. I'm running the following code. $IpRange = New-Object -TypeName Amazon.EC2.Model.IpRange $IpRange.CidrIp = "<IPAddr>/32" $IpRange.Description = "Sean" $IpPermission = New-Object Amazon.EC2.Model.IpPermission $IpPermission.IpProtocol = "tcp" $IpPermission.ToPort = 3389 $IpPermission.FromPort = 3389 $IpPermission.Ipv4Ranges = $IpRange Grant-EC2SecurityGroupIngress -GroupId sg-00xxxx -IpPermission $IpPermission

It seems to work just fine at the cmdline, but nothing gets pushed to AWS. Is there something else I need to do?

asked 2 years ago260 views
1 Answer
0

Hi,

Use the below link for guidance to setup your security group using powershell[1]https://docs.aws.amazon.com/powershell/latest/userguide/pstools-ec2-sg.html

When viewing the security group please make sure you are in the correct region, consider using DescribeSecurityGroups API call to view your security group if it was created succesfullly[1]https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeSecurityGroups.html

secondly you can use cloudtrail to check the api call when you create a security group[2]https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateSecurityGroup.html

And if you are using Powershell you need to have AWS powershell tools installed[3]https://aws.amazon.com/powershell/

you can also try using Systems Manager Run Command AWS-RunPowerShellScript document[4]https://docs.aws.amazon.com/systems-manager/latest/userguide/run-command.html

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions