Protection Group Args
data class ProtectionGroupArgs(val aggregation: Output<String>? = null, val members: Output<List<String>>? = null, val pattern: Output<String>? = null, val protectionGroupId: Output<String>? = null, val resourceType: Output<String>? = null, val tags: Output<Map<String, String>>? = null) : ConvertibleToJava<ProtectionGroupArgs>
Creates a grouping of protected resources so they can be handled as a collective. This resource grouping improves the accuracy of detection and reduces false positives. For more information see Managing AWS Shield Advanced protection groups
Example Usage
Create protection group for all resources
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.shield.ProtectionGroup;
import com.pulumi.aws.shield.ProtectionGroupArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new ProtectionGroup("example", ProtectionGroupArgs.builder()
.aggregation("MAX")
.pattern("ALL")
.protectionGroupId("example")
.build());
}
}
Content copied to clipboard
Create protection group for arbitrary number of resources
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.AwsFunctions;
import com.pulumi.aws.inputs.GetRegionArgs;
import com.pulumi.aws.ec2.Eip;
import com.pulumi.aws.ec2.EipArgs;
import com.pulumi.aws.shield.Protection;
import com.pulumi.aws.shield.ProtectionArgs;
import com.pulumi.aws.shield.ProtectionGroup;
import com.pulumi.aws.shield.ProtectionGroupArgs;
import com.pulumi.resources.CustomResourceOptions;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var currentRegion = AwsFunctions.getRegion();
final var currentCallerIdentity = AwsFunctions.getCallerIdentity();
var exampleEip = new Eip("exampleEip", EipArgs.builder()
.vpc(true)
.build());
var exampleProtection = new Protection("exampleProtection", ProtectionArgs.builder()
.resourceArn(exampleEip.id().applyValue(id -> String.format("arn:aws:ec2:%s:%s:eip-allocation/%s", currentRegion.applyValue(getRegionResult -> getRegionResult.name()),currentCallerIdentity.applyValue(getCallerIdentityResult -> getCallerIdentityResult.accountId()),id)))
.build());
var exampleProtectionGroup = new ProtectionGroup("exampleProtectionGroup", ProtectionGroupArgs.builder()
.protectionGroupId("example")
.aggregation("MEAN")
.pattern("ARBITRARY")
.members(exampleEip.id().applyValue(id -> String.format("arn:aws:ec2:%s:%s:eip-allocation/%s", currentRegion.applyValue(getRegionResult -> getRegionResult.name()),currentCallerIdentity.applyValue(getCallerIdentityResult -> getCallerIdentityResult.accountId()),id)))
.build(), CustomResourceOptions.builder()
.dependsOn(exampleProtection)
.build());
}
}
Content copied to clipboard
Create protection group for a type of resource
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.shield.ProtectionGroup;
import com.pulumi.aws.shield.ProtectionGroupArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new ProtectionGroup("example", ProtectionGroupArgs.builder()
.aggregation("SUM")
.pattern("BY_RESOURCE_TYPE")
.protectionGroupId("example")
.resourceType("ELASTIC_IP_ALLOCATION")
.build());
}
}
Content copied to clipboard
Import
Shield protection group resources can be imported by specifying their protection group id.
$ pulumi import aws:shield/protectionGroup:ProtectionGroup example example
Content copied to clipboard
Constructors
Properties
Link copied to clipboard
Defines how AWS Shield combines resource data for the group in order to detect, mitigate, and report events.
Link copied to clipboard
The name of the protection group.
Link copied to clipboard
The resource type to include in the protection group. You must set this when you set pattern
to BY_RESOURCE_TYPE and you must not set it for any other pattern
setting.