Skip to main content

security_groups

Creates, updates, deletes or gets a security_group resource or lists security_groups in a region

Overview

Namesecurity_groups
TypeResource
DescriptionResource Type definition for AWS::EC2::SecurityGroup
Idawscc.ec2.security_groups

Fields

NameDatatypeDescription
group_descriptionstringA description for the security group.
group_namestringThe name of the security group.
vpc_idstringThe ID of the VPC for the security group.
idstringThe group name or group ID depending on whether the SG is created in default or specific VPC
security_group_ingressarrayThe inbound rules associated with the security group. There is a short interruption during which you cannot connect to the security group.
security_group_egressarray[VPC only] The outbound rules associated with the security group. There is a short interruption during which you cannot connect to the security group.
tagsarrayAny tags assigned to the security group.
group_idstringThe group ID of the specified security group.
regionstringAWS region.

For more information, see AWS::EC2::SecurityGroup.

Methods

NameResourceAccessible byRequired Params
create_resourcesecurity_groupsINSERTGroupDescription, region
delete_resourcesecurity_groupsDELETEIdentifier, region
update_resourcesecurity_groupsUPDATEIdentifier, PatchDocument, region
list_resourcessecurity_groups_list_onlySELECTregion
get_resourcesecurity_groupsSELECTIdentifier, region

SELECT examples

Gets all properties from an individual security_group.

SELECT
region,
group_description,
group_name,
vpc_id,
id,
security_group_ingress,
security_group_egress,
tags,
group_id
FROM awscc.ec2.security_groups
WHERE
region = 'us-east-1' AND
Identifier = '{{ id }}';

INSERT example

Use the following StackQL query and manifest file to create a new security_group resource, using stack-deploy.

/*+ create */
INSERT INTO awscc.ec2.security_groups (
GroupDescription,
region
)
SELECT
'{{ group_description }}',
'{{ region }}';

UPDATE example

Use the following StackQL query and manifest file to update a security_group resource, using stack-deploy.

/*+ update */
UPDATE awscc.ec2.security_groups
SET PatchDocument = string('{{ {
"SecurityGroupIngress": security_group_ingress,
"SecurityGroupEgress": security_group_egress,
"Tags": tags
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ id }}';

DELETE example

/*+ delete */
DELETE FROM awscc.ec2.security_groups
WHERE
Identifier = '{{ id }}' AND
region = 'us-east-1';

Permissions

To operate on the security_groups resource, the following permissions are required:

ec2:DescribeSecurityGroups