
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
@pulumi/awsguard
Advanced tools
NOTE: This library is part of Pulumi's Policy as Code offering. It is currently being previewed and is subject to breaking changes. We've included an initial set of policies for AWS and are in the process of adding many more.
AWSGuard codifies best practices for AWS. This is a configurable library that you can use to enforce these best practices for your own Pulumi stacks or organization.
For more information on Pulumi's Policy as Code solution, visit our docs.
In this guide, we'll show you how to create a Policy Pack that configures and uses the policies available in AWSGuard.
pulumi version # should be v2.0.0 or later
To use AWSGuard policies, you must create a Policy Pack that references the @pulumi/awsguard
npm package and in the implementation of the Policy Pack, create a new instance of the AwsGuard
class.
Create a directory for your new Policy Pack, and change into it.
mkdir awsguard && cd awsguard
Run the pulumi policy new
command.
pulumi policy new awsguard-typescript
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 },
});
Policy Packs can be tested on a user's local workstation to facilitate rapid development and testing of policies.
Run npm install
in the Policy Pack directory.
Use the --policy-pack
flag with pulumi preview
or pulumi up
to specify the path to the directory containing your Policy Pack when previewing/updating a Pulumi program.
If you don’t have a Pulumi program readily available, you can create a new project for testing by running pulumi new aws-typescript
in an empty directory. This AWS example will create an S3 bucket, which is perfect for testing our Policy.
In the Pulumi project's directory run:
pulumi preview --policy-pack <path-to-policy-pack-directory>
If the stack is not in compliance, the policy violation will be displayed. Since the enforcement level for all policies are set to advisory, a warning is shown for any resources that are not in compliance with the AWSGuard policies. In this case, logging must be defined for S3 buckets.
Previewing update (dev):
Type Name Plan Info
+ pulumi:pulumi:Stack test-dev create
+ └─ aws:s3:Bucket my-bucket create 1 warning
Policy Violations:
[advisory] pulumi-awsguard v0.0.1 s3-bucket-logging-enabled (my-bucket: aws:s3/bucket:Bucket)
Checks whether logging is enabled for your S3 buckets.
Bucket logging must be defined.
If you had wanted the preview to fail for any policy violations, the Policy Pack can be modified to configure all policies to be mandatory.
new AwsGuard({ all: "mandatory" });
Running the pulumi preview
command again will now fail the preview operation.
Previewing update (dev):
Type Name Plan Info
+ pulumi:pulumi:Stack test-dev create 1 error
+ └─ aws:s3:Bucket my-bucket create 1 error
Diagnostics:
pulumi:pulumi:Stack (test-dev):
error: preview failed
Policy Violations:
[mandatory] pulumi-awsguard v0.0.1 s3-bucket-logging-enabled (my-bucket: aws:s3/bucket:Bucket)
Checks whether logging is enabled for your S3 buckets.
Bucket logging must be defined.
If you do not want to enforce this particular policy, you can modify the Policy Pack to disable it.
new AwsGuard({
all: "mandatory",
s3BucketLoggingEnabled: "disabled",
});
0.4.0 (2022-09-22)
@pulumi/aws
version to ^5.0.0 to fix 4.0.0 conflicts
#85FAQs
Pulumi CrossGuard policies for AWS.
The npm package @pulumi/awsguard receives a total of 9,236 weekly downloads. As such, @pulumi/awsguard popularity was classified as popular.
We found that @pulumi/awsguard demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.