[ aws . network-firewall ]
Creates the specified stateless or stateful rule group, which includes the rules for network traffic inspection, a capacity setting, and tags.
You provide your rule group specification in your request using either RuleGroup
or Rules
.
See also: AWS API Documentation
See ‘aws help’ for descriptions of global parameters.
create-rule-group
--rule-group-name <value>
[--rule-group <value>]
[--rules <value>]
--type <value>
[--description <value>]
--capacity <value>
[--tags <value>]
[--dry-run | --no-dry-run]
[--cli-input-json | --cli-input-yaml]
[--generate-cli-skeleton <value>]
--rule-group-name
(string)
The descriptive name of the rule group. You can’t change the name of a rule group after you create it.
--rule-group
(structure)
An object that defines the rule group rules.
Note
You must provide either this rule group setting or a
Rules
setting, but not both.RuleVariables -> (structure)
Settings that are available for use in the rules in the rule group. You can only use these for stateful rule groups.
IPSets -> (map)
A list of IP addresses and address ranges, in CIDR notation.
key -> (string)
value -> (structure)
A list of IP addresses and address ranges, in CIDR notation. This is part of a RuleVariables .
Definition -> (list)
The list of IP addresses and address ranges, in CIDR notation.
(string)
PortSets -> (map)
A list of port ranges.
key -> (string)
value -> (structure)
A set of port ranges for use in the rules in a rule group.
Definition -> (list)
The set of port ranges.
(string)
RulesSource -> (structure)
The stateful rules or stateless rules for the rule group.
RulesString -> (string)
Stateful inspection criteria, provided in Suricata compatible intrusion prevention system (IPS) rules. Suricata is an open-source network IPS that includes a standard rule-based language for network traffic inspection.
These rules contain the inspection criteria and the action to take for traffic that matches the criteria, so this type of rule group doesn’t have a separate action setting.
RulesSourceList -> (structure)
Stateful inspection criteria for a domain list rule group.
Targets -> (list)
The domains that you want to inspect for in your traffic flows. To provide multiple domains, separate them with commas. Valid domain specifications are the following:
Explicit names. For example,
abc.example.com
matches only the domainabc.example.com
.Names that use a domain wildcard, which you indicate with an initial ‘
.
‘. For example,``.example.com`` matchesexample.com
and matches all subdomains ofexample.com
, such asabc.example.com
andwww.example.com
.(string)
TargetTypes -> (list)
The protocols you want to inspect. Specify
TLS_SNI
forHTTPS
. SpecityHTTP_HOST
forHTTP
. You can specify either or both.(string)
GeneratedRulesType -> (string)
Whether you want to allow or deny access to the domains in your target list.
StatefulRules -> (list)
The 5-tuple stateful inspection criteria. This contains an array of individual 5-tuple stateful rules to be used together in a stateful rule group.
(structure)
A single 5-tuple stateful rule, for use in a stateful rule group.
Action -> (string)
Defines what Network Firewall should do with the packets in a traffic flow when the flow matches the stateful rule criteria. For all actions, Network Firewall performs the specified action and discontinues stateful inspection of the traffic flow.
The actions for a stateful rule are defined as follows:
PASS - Permits the packets to go to the intended destination.
DROP - Blocks the packets from going to the intended destination and sends an alert log message, if alert logging is configured in the Firewall LoggingConfiguration .
ALERT - Permits the packets to go to the intended destination and sends an alert log message, if alert logging is configured in the Firewall LoggingConfiguration . You can use this action to test a rule that you intend to use to drop traffic. You can enable the rule with
ALERT
action, verify in the logs that the rule is filtering as you want, then change the action toDROP
.Header -> (structure)
The stateful 5-tuple inspection criteria for this rule, used to inspect traffic flows.
Protocol -> (string)
The protocol to inspect for.
Source -> (string)
The source IP address or address range to inspect for, in CIDR notation. To match with any address, specify
ANY
.Specify an IP address or a block of IP addresses in Classless Inter-Domain Routing (CIDR) notation. Network Firewall supports all address ranges for IPv4.
Examples:
To configure Network Firewall to inspect for the IP address 192.0.2.44, specify
192.0.2.44/32
.To configure Network Firewall to inspect for IP addresses from 192.0.2.0 to 192.0.2.255, specify
192.0.2.0/24
.For more information about CIDR notation, see the Wikipedia entry Classless Inter-Domain Routing .
SourcePort -> (string)
The source port to inspect for. You can specify an individual port, for example
1994
and you can specify a port range, for example1990-1994
. To match with any port, specifyANY
.Direction -> (string)
The direction of traffic flow to inspect. If set to
ANY
, the inspection matches bidirectional traffic, both from the source to the destination and from the destination to the source. If set toFORWARD
, the inspection only matches traffic going from the source to the destination.Destination -> (string)
The destination IP address or address range to inspect for, in CIDR notation. To match with any address, specify
ANY
.Specify an IP address or a block of IP addresses in Classless Inter-Domain Routing (CIDR) notation. Network Firewall supports all address ranges for IPv4.
Examples:
To configure Network Firewall to inspect for the IP address 192.0.2.44, specify
192.0.2.44/32
.To configure Network Firewall to inspect for IP addresses from 192.0.2.0 to 192.0.2.255, specify
192.0.2.0/24
.For more information about CIDR notation, see the Wikipedia entry Classless Inter-Domain Routing .
DestinationPort -> (string)
The destination port to inspect for. You can specify an individual port, for example
1994
and you can specify a port range, for example1990-1994
. To match with any port, specifyANY
.RuleOptions -> (list)
(structure)
Additional settings for a stateful rule. This is part of the StatefulRule configuration.
Keyword -> (string)
Settings -> (list)
(string)
StatelessRulesAndCustomActions -> (structure)
Stateless inspection criteria to be used in a stateless rule group.
StatelessRules -> (list)
Defines the set of stateless rules for use in a stateless rule group.
(structure)
A single stateless rule. This is used in StatelessRulesAndCustomActions .
RuleDefinition -> (structure)
Defines the stateless 5-tuple packet inspection criteria and the action to take on a packet that matches the criteria.
MatchAttributes -> (structure)
Criteria for Network Firewall to use to inspect an individual packet in stateless rule inspection. Each match attributes set can include one or more items such as IP address, CIDR range, port number, protocol, and TCP flags.
Sources -> (list)
The source IP addresses and address ranges to inspect for, in CIDR notation. If not specified, this matches with any source address.
(structure)
A single IP address specification. This is used in the MatchAttributes source and destination specifications.
AddressDefinition -> (string)
Specify an IP address or a block of IP addresses in Classless Inter-Domain Routing (CIDR) notation. Network Firewall supports all address ranges for IPv4.
Examples:
To configure Network Firewall to inspect for the IP address 192.0.2.44, specify
192.0.2.44/32
.To configure Network Firewall to inspect for IP addresses from 192.0.2.0 to 192.0.2.255, specify
192.0.2.0/24
.For more information about CIDR notation, see the Wikipedia entry Classless Inter-Domain Routing .
Destinations -> (list)
The destination IP addresses and address ranges to inspect for, in CIDR notation. If not specified, this matches with any destination address.
(structure)
A single IP address specification. This is used in the MatchAttributes source and destination specifications.
AddressDefinition -> (string)
Specify an IP address or a block of IP addresses in Classless Inter-Domain Routing (CIDR) notation. Network Firewall supports all address ranges for IPv4.
Examples:
To configure Network Firewall to inspect for the IP address 192.0.2.44, specify
192.0.2.44/32
.To configure Network Firewall to inspect for IP addresses from 192.0.2.0 to 192.0.2.255, specify
192.0.2.0/24
.For more information about CIDR notation, see the Wikipedia entry Classless Inter-Domain Routing .
SourcePorts -> (list)
The source ports to inspect for. If not specified, this matches with any source port. This setting is only used for protocols 6 (TCP) and 17 (UDP).
You can specify individual ports, for example
1994
and you can specify port ranges, for example1990-1994
.(structure)
A single port range specification. This is used for source and destination port ranges in the stateless rule MatchAttributes ,
SourcePorts
, andDestinationPorts
settings.FromPort -> (integer)
The lower limit of the port range. This must be less than or equal to the
ToPort
specification.ToPort -> (integer)
The upper limit of the port range. This must be greater than or equal to the
FromPort
specification.DestinationPorts -> (list)
The destination ports to inspect for. If not specified, this matches with any destination port. This setting is only used for protocols 6 (TCP) and 17 (UDP).
You can specify individual ports, for example
1994
and you can specify port ranges, for example1990-1994
.(structure)
A single port range specification. This is used for source and destination port ranges in the stateless rule MatchAttributes ,
SourcePorts
, andDestinationPorts
settings.FromPort -> (integer)
The lower limit of the port range. This must be less than or equal to the
ToPort
specification.ToPort -> (integer)
The upper limit of the port range. This must be greater than or equal to the
FromPort
specification.Protocols -> (list)
The protocols to inspect for, specified using each protocol’s assigned internet protocol number (IANA). If not specified, this matches with any protocol.
(integer)
TCPFlags -> (list)
The TCP flags and masks to inspect for. If not specified, this matches with any settings. This setting is only used for protocol 6 (TCP).
(structure)
TCP flags and masks to inspect packets for, used in stateless rules MatchAttributes settings.
Flags -> (list)
Used in conjunction with the
Masks
setting to define the flags that must be set and flags that must not be set in order for the packet to match. This setting can only specify values that are also specified in theMasks
setting.For the flags that are specified in the masks setting, the following must be true for the packet to match:
The ones that are set in this flags setting must be set in the packet.
The ones that are not set in this flags setting must also not be set in the packet.
(string)
Masks -> (list)
The set of flags to consider in the inspection. To inspect all flags in the valid values list, leave this with no setting.
(string)
Actions -> (list)
The actions to take on a packet that matches one of the stateless rule definition’s match attributes. You must specify a standard action and you can add custom actions.
Note
Network Firewall only forwards a packet for stateful rule inspection if you specify
aws:forward_to_sfe
for a rule that the packet matches, or if the packet doesn’t match any stateless rule and you specifyaws:forward_to_sfe
for theStatelessDefaultActions
setting for the FirewallPolicy .For every rule, you must specify exactly one of the following standard actions.
aws:pass - Discontinues all inspection of the packet and permits it to go to its intended destination.
aws:drop - Discontinues all inspection of the packet and blocks it from going to its intended destination.
aws:forward_to_sfe - Discontinues stateless inspection of the packet and forwards it to the stateful rule engine for inspection.
Additionally, you can specify a custom action. To do this, you define a custom action by name and type, then provide the name you’ve assigned to the action in this
Actions
setting. For information about the options, see CustomAction .To provide more than one action in this setting, separate the settings with a comma. For example, if you have a custom
PublishMetrics
action that you’ve namedMyMetricsAction
, then you could specify the standard actionaws:pass
and the custom action with[“aws:pass”, “MyMetricsAction”]
.(string)
Priority -> (integer)
A setting that indicates the order in which to run this rule relative to all of the rules that are defined for a stateless rule group. Network Firewall evaluates the rules in a rule group starting with the lowest priority setting. You must ensure that the priority settings are unique for the rule group.
Each stateless rule group uses exactly one
StatelessRulesAndCustomActions
object, and eachStatelessRulesAndCustomActions
contains exactly oneStatelessRules
object. To ensure unique priority settings for your rule groups, set unique priorities for the stateless rules that you define inside any singleStatelessRules
object.You can change the priority settings of your rules at any time. To make it easier to insert rules later, number them so there’s a wide range in between, for example use 100, 200, and so on.
CustomActions -> (list)
Defines an array of individual custom action definitions that are available for use by the stateless rules in this
StatelessRulesAndCustomActions
specification. You name each custom action that you define, and then you can use it by name in your StatelessRule RuleDefinitionActions
specification.(structure)
An optional, non-standard action to use for stateless packet handling. You can define this in addition to the standard action that you must specify.
You define and name the custom actions that you want to be able to use, and then you reference them by name in your actions settings.
You can use custom actions in the following places:
In a rule group’s StatelessRulesAndCustomActions specification. The custom actions are available for use by name inside the
StatelessRulesAndCustomActions
where you define them. You can use them for your stateless rule actions to specify what to do with a packet that matches the rule’s match attributes.In a FirewallPolicy specification, in
StatelessCustomActions
. The custom actions are available for use inside the policy where you define them. You can use them for the policy’s default stateless actions settings to specify what to do with packets that don’t match any of the policy’s stateless rules.ActionName -> (string)
The descriptive name of the custom action. You can’t change the name of a custom action after you create it.
ActionDefinition -> (structure)
The custom action associated with the action name.
PublishMetricAction -> (structure)
Stateless inspection criteria that publishes the specified metrics to Amazon CloudWatch for the matching packet. This setting defines a CloudWatch dimension value to be published.
You can pair this custom action with any of the standard stateless rule actions. For example, you could pair this in a rule action with the standard action that forwards the packet for stateful inspection. Then, when a packet matches the rule, Network Firewall publishes metrics for the packet and forwards it.
Dimensions -> (list)
(structure)
The value to use in an Amazon CloudWatch custom metric dimension. This is used in the
PublishMetrics
CustomAction . A CloudWatch custom metric dimension is a name/value pair that’s part of the identity of a metric.AWS Network Firewall sets the dimension name to
CustomAction
and you provide the dimension value.For more information about CloudWatch custom metric dimensions, see Publishing Custom Metrics in the Amazon CloudWatch User Guide .
Value -> (string)
The value to use in the custom metric dimension.
JSON Syntax:
{
"RuleVariables": {
"IPSets": {"string": {
"Definition": ["string", ...]
}
...},
"PortSets": {"string": {
"Definition": ["string", ...]
}
...}
},
"RulesSource": {
"RulesString": "string",
"RulesSourceList": {
"Targets": ["string", ...],
"TargetTypes": ["TLS_SNI"|"HTTP_HOST", ...],
"GeneratedRulesType": "ALLOWLIST"|"DENYLIST"
},
"StatefulRules": [
{
"Action": "PASS"|"DROP"|"ALERT",
"Header": {
"Protocol": "IP"|"TCP"|"UDP"|"ICMP"|"HTTP"|"FTP"|"TLS"|"SMB"|"DNS"|"DCERPC"|"SSH"|"SMTP"|"IMAP"|"MSN"|"KRB5"|"IKEV2"|"TFTP"|"NTP"|"DHCP",
"Source": "string",
"SourcePort": "string",
"Direction": "FORWARD"|"ANY",
"Destination": "string",
"DestinationPort": "string"
},
"RuleOptions": [
{
"Keyword": "string",
"Settings": ["string", ...]
}
...
]
}
...
],
"StatelessRulesAndCustomActions": {
"StatelessRules": [
{
"RuleDefinition": {
"MatchAttributes": {
"Sources": [
{
"AddressDefinition": "string"
}
...
],
"Destinations": [
{
"AddressDefinition": "string"
}
...
],
"SourcePorts": [
{
"FromPort": integer,
"ToPort": integer
}
...
],
"DestinationPorts": [
{
"FromPort": integer,
"ToPort": integer
}
...
],
"Protocols": [integer, ...],
"TCPFlags": [
{
"Flags": ["FIN"|"SYN"|"RST"|"PSH"|"ACK"|"URG"|"ECE"|"CWR", ...],
"Masks": ["FIN"|"SYN"|"RST"|"PSH"|"ACK"|"URG"|"ECE"|"CWR", ...]
}
...
]
},
"Actions": ["string", ...]
},
"Priority": integer
}
...
],
"CustomActions": [
{
"ActionName": "string",
"ActionDefinition": {
"PublishMetricAction": {
"Dimensions": [
{
"Value": "string"
}
...
]
}
}
}
...
]
}
}
}
--rules
(string)
The name of a file containing stateful rule group rules specifications in Suricata flat format, with one rule per line. Use this to import your existing Suricata compatible rule groups.
Note
You must provide either this rules setting or a populated
RuleGroup
setting, but not both.You can provide your rule group specification in a file through this setting when you create or update your rule group. The call response returns a RuleGroup object that Network Firewall has populated from your file. Network Firewall uses the file contents to populate the rule group rules, but does not maintain a reference to the file or use the file in any way after performing the create or update. If you call DescribeRuleGroup to retrieve the rule group, Network Firewall returns rules settings inside a RuleGroup object.
--type
(string)
Indicates whether the rule group is stateless or stateful. If the rule group is stateless, it contains stateless rules. If it is stateful, it contains stateful rules.
Possible values:
STATELESS
STATEFUL
--description
(string)
A description of the rule group.
--capacity
(integer)
The maximum operating resources that this rule group can use. Rule group capacity is fixed at creation. When you update a rule group, you are limited to this capacity. When you reference a rule group from a firewall policy, Network Firewall reserves this capacity for the rule group.
You can retrieve the capacity that would be required for a rule group before you create the rule group by calling CreateRuleGroup with
DryRun
set toTRUE
.Note
You can’t change or exceed this capacity when you update the rule group, so leave room for your rule group to grow.
Capacity for a stateless rule group
For a stateless rule group, the capacity required is the sum of the capacity requirements of the individual rules that you expect to have in the rule group.
To calculate the capacity requirement of a single rule, multiply the capacity requirement values of each of the rule’s match settings:
A match setting with no criteria specified has a value of 1.
A match setting with
Any
specified has a value of 1.All other match settings have a value equal to the number of elements provided in the setting. For example, a protocol setting [“UDP”] and a source setting [“10.0.0.0/24”] each have a value of 1. A protocol setting [“UDP”,”TCP”] has a value of 2. A source setting [“10.0.0.0/24”,”10.0.0.1/24”,”10.0.0.2/24”] has a value of 3.
A rule with no criteria specified in any of its match settings has a capacity requirement of 1. A rule with protocol setting [“UDP”,”TCP”], source setting [“10.0.0.0/24”,”10.0.0.1/24”,”10.0.0.2/24”], and a single specification or no specification for each of the other match settings has a capacity requirement of 6.
Capacity for a stateful rule group
For a stateful rule group, the minimum capacity required is the number of individual rules that you expect to have in the rule group.
--tags
(list)
The key:value pairs to associate with the resource.
(structure)
A key:value pair associated with an AWS resource. The key:value pair can be anything you define. Typically, the tag key represents a category (such as “environment”) and the tag value represents a specific value within that category (such as “test,” “development,” or “production”). You can add up to 50 tags to each AWS resource.
Key -> (string)
The part of the key:value pair that defines a tag. You can use a tag key to describe a category of information, such as “customer.” Tag keys are case-sensitive.
Value -> (string)
The part of the key:value pair that defines a tag. You can use a tag value to describe a specific value within a category, such as “companyA” or “companyB.” Tag values are case-sensitive.
Shorthand Syntax:
Key=string,Value=string ...
JSON Syntax:
[
{
"Key": "string",
"Value": "string"
}
...
]
--dry-run
| --no-dry-run
(boolean)
Indicates whether you want Network Firewall to just check the validity of the request, rather than run the request.
If set to
TRUE
, Network Firewall checks whether the request can run successfully, but doesn’t actually make the requested changes. The call returns the value that the request would return if you ran it with dry run set toFALSE
, but doesn’t make additions or changes to your resources. This option allows you to make sure that you have the required permissions to run the request and that your request parameters are valid.If set to
FALSE
, Network Firewall makes the requested changes to your resources.
--cli-input-json
| --cli-input-yaml
(string)
Reads arguments from the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton
. If other arguments are provided on the command line, those values will override the JSON-provided values. It is not possible to pass arbitrary binary values using a JSON-provided value as the string will be taken literally. This may not be specified along with --cli-input-yaml
.
--generate-cli-skeleton
(string)
Prints a JSON skeleton to standard output without sending an API request. If provided with no value or the value input
, prints a sample input JSON that can be used as an argument for --cli-input-json
. Similarly, if provided yaml-input
it will print a sample input YAML that can be used with --cli-input-yaml
. If provided with the value output
, it validates the command inputs and returns a sample output JSON for that command.
See ‘aws help’ for descriptions of global parameters.
UpdateToken -> (string)
A token used for optimistic locking. Network Firewall returns a token to your requests that access the rule group. The token marks the state of the rule group resource at the time of the request.
To make changes to the rule group, you provide the token in your request. Network Firewall uses the token to ensure that the rule group hasn’t changed since you last retrieved it. If it has changed, the operation fails with an
InvalidTokenException
. If this happens, retrieve the rule group again to get a current copy of it with a current token. Reapply your changes as needed, then try the operation again using the new token.
RuleGroupResponse -> (structure)
The high-level properties of a rule group. This, along with the RuleGroup , define the rule group. You can retrieve all objects for a rule group by calling DescribeRuleGroup .
RuleGroupArn -> (string)
The Amazon Resource Name (ARN) of the rule group.
Note
If this response is for a create request that had
DryRun
set toTRUE
, then this ARN is a placeholder that isn’t attached to a valid resource.RuleGroupName -> (string)
The descriptive name of the rule group. You can’t change the name of a rule group after you create it.
RuleGroupId -> (string)
The unique identifier for the rule group.
Description -> (string)
A description of the rule group.
Type -> (string)
Indicates whether the rule group is stateless or stateful. If the rule group is stateless, it contains stateless rules. If it is stateful, it contains stateful rules.
Capacity -> (integer)
The maximum operating resources that this rule group can use. Rule group capacity is fixed at creation. When you update a rule group, you are limited to this capacity. When you reference a rule group from a firewall policy, Network Firewall reserves this capacity for the rule group.
You can retrieve the capacity that would be required for a rule group before you create the rule group by calling CreateRuleGroup with
DryRun
set toTRUE
.RuleGroupStatus -> (string)
Detailed information about the current status of a rule group.
Tags -> (list)
The key:value pairs to associate with the resource.
(structure)
A key:value pair associated with an AWS resource. The key:value pair can be anything you define. Typically, the tag key represents a category (such as “environment”) and the tag value represents a specific value within that category (such as “test,” “development,” or “production”). You can add up to 50 tags to each AWS resource.
Key -> (string)
The part of the key:value pair that defines a tag. You can use a tag key to describe a category of information, such as “customer.” Tag keys are case-sensitive.
Value -> (string)
The part of the key:value pair that defines a tag. You can use a tag value to describe a specific value within a category, such as “companyA” or “companyB.” Tag values are case-sensitive.