Creating a security group
Next, create a Security group using the VPC created in the previous section on creating a cluster. The AWS region is required to be specified in the following command, if not configured in persisted/shell defaults:
$groupid = New-EC2SecurityGroup -VpcId "vpc-6e021915" -Region "us-east-1" -GroupName "hello-worldPSSecurityGroup" -GroupDescription "EC2-VPC from PowerShell"
List the EC2 security group with the following Get-EC2SecurityGroup
command:
Get-EC2SecurityGroup -Region "us-east-1" -GroupId $groupid
The EC2 security group gets listed, as shown here:
![](https://static.packt-cdn.com/products/9781789345018/graphics/f41b3f48-4897-4788-b52e-b826ed4c0142.png)
If required, the EC2 security group may be removed with the following command:
Remove-EC2SecurityGroup -Region "us-east-1" $groupid