Tweak the code in the index.ts
file as desired. The default implementation provided by the awsguard-typescript
template simply creates a new instance of AwsGuard
with all policies set to have an enforcement level of advisory.
new AwsGuard({ all: "advisory" });
From here, you can change the enforcement level for all policies or configure individual policies.
For example:
To make all policies mandatory rather than advisory:
new AwsGuard({ all: "mandatory" });
To make all policies mandatory, but change certain policies to be advisory:
new AwsGuard({
all: "mandatory",
ec2InstanceNoPublicIP: "advisory",
elbAccessLoggingEnabled: "advisory",
});
To disable a particular policy:
new AwsGuard({
ec2InstanceNoPublicIP: "disabled",
});
To disable all policies except ones explicitly enabled:
new AwsGuard({
all: "disabled",
ec2InstanceNoPublicIP: "mandatory",
elbAccessLoggingEnabled: "mandatory",
});
To specify additional configuration for policies that support it:
new AwsGuard({
ec2VolumeInUse: { checkDeletion: false },
encryptedVolumes: { enforcementLevel: "mandatory", kmsId: "id" },
redshiftClusterMaintenanceSettings: { preferredMaintenanceWindow: "Mon:09:30-Mon:10:00" },
acmCertificateExpiration: { maxDaysUntilExpiration: 10 },
});