|
| 1 | +--- |
| 2 | +categories: ["compute", "networking", "security"] |
| 3 | +primary_category: "security" |
| 4 | +--- |
| 5 | + |
| 6 | +# Enforce AWS Redshift Clusters Are Not Publicly Accessible |
| 7 | + |
| 8 | +Enforcing that AWS Redshift Clusters are not publicly accessible is crucial for protecting sensitive data and ensuring database security. This measure prevents unauthorized internet access to your Redshift clusters, reducing the risk of data breaches and enhancing compliance with security best practices and regulatory requirements. |
| 9 | + |
| 10 | +This [policy pack](https://turbot.com/guardrails/docs/concepts/policy-packs) can help you configure the following settings for Redshift clusters: |
| 11 | + |
| 12 | +- Enforce Redshift clusters to not be publicly accessible |
| 13 | + |
| 14 | +## Documentation |
| 15 | + |
| 16 | +- **[Review policy settings →](https://hub.guardrails.turbot.com/policy-packs/aws_redshift_enforce_clusters_are_not_publicly_accessible/settings)** |
| 17 | + |
| 18 | +## Getting Started |
| 19 | + |
| 20 | +### Requirements |
| 21 | + |
| 22 | +- [Terraform](https://developer.hashicorp.com/terraform/install) |
| 23 | +- Guardrails mods: |
| 24 | + - [@turbot/aws-redshift](https://hub.guardrails.turbot.com/mods/aws/mods/aws-redshift) |
| 25 | + |
| 26 | +### Credentials |
| 27 | + |
| 28 | +To create a policy pack through Terraform: |
| 29 | + |
| 30 | +- Ensure you have `Turbot/Admin` permissions (or higher) in Guardrails |
| 31 | +- [Create access keys](https://turbot.com/guardrails/docs/guides/iam/access-keys#generate-a-new-guardrails-api-access-key) in Guardrails |
| 32 | + |
| 33 | +And then set your credentials: |
| 34 | + |
| 35 | +```sh |
| 36 | +export TURBOT_WORKSPACE=myworkspace.acme.com |
| 37 | +export TURBOT_ACCESS_KEY=acce6ac5-access-key-here |
| 38 | +export TURBOT_SECRET_KEY=a8af61ec-secret-key-here |
| 39 | +``` |
| 40 | + |
| 41 | +Please see [Turbot Guardrails Provider authentication](https://registry.terraform.io/providers/turbot/turbot/latest/docs#authentication) for additional authentication methods. |
| 42 | + |
| 43 | +## Usage |
| 44 | + |
| 45 | +### Install Policy Pack |
| 46 | + |
| 47 | +> [!NOTE] |
| 48 | +> By default, installed policy packs are not attached to any resources. |
| 49 | +> |
| 50 | +> Policy packs must be attached to resources in order for their policy settings to take effect. |
| 51 | +
|
| 52 | +Clone: |
| 53 | + |
| 54 | +```sh |
| 55 | +git clone https://github.com/turbot/guardrails-samples.git |
| 56 | +cd guardrails-samples/policy_packs/aws/redshift/enforce_clusters_are_not_publicly_accessible |
| 57 | +``` |
| 58 | + |
| 59 | +Run the Terraform to create the policy pack in your workspace: |
| 60 | + |
| 61 | +```sh |
| 62 | +terraform init |
| 63 | +terraform plan |
| 64 | +``` |
| 65 | + |
| 66 | +Then apply the changes: |
| 67 | + |
| 68 | +```sh |
| 69 | +terraform apply |
| 70 | +``` |
| 71 | + |
| 72 | +### Apply Policy Pack |
| 73 | + |
| 74 | +Log into your Guardrails workspace and [attach the policy pack to a resource](https://turbot.com/guardrails/docs/guides/policy-packs#attach-a-policy-pack-to-a-resource). |
| 75 | + |
| 76 | +If this policy pack is attached to a Guardrails folder, its policies will be applied to all accounts and resources in that folder. The policy pack can also be attached to multiple resources. |
| 77 | + |
| 78 | +For more information, please see [Policy Packs](https://turbot.com/guardrails/docs/concepts/policy-packs). |
| 79 | + |
| 80 | +### Enable Enforcement |
| 81 | + |
| 82 | +> [!TIP] |
| 83 | +> You can also update the policy settings in this policy pack directly in the Guardrails console. |
| 84 | +> |
| 85 | +> Please note your Terraform state file will then become out of sync and the policy settings should then only be managed in the console. |
| 86 | +
|
| 87 | +By default, the policies are set to `Check` in the pack's policy settings. To enable automated enforcements, you can switch these policies settings by adding a comment to the `Check` setting and removing the comment from one of the listed enforcement options: |
| 88 | + |
| 89 | +```hcl |
| 90 | +resource "turbot_policy_setting" "aws_redshift_cluster_publicly_accessible" { |
| 91 | + resource = turbot_policy_pack.main.id |
| 92 | + type = "tmod:@turbot/aws-redshift#/policy/types/clusterPubliclyAccessible" |
| 93 | + # value = "Check: Cluster is not publicly accessible" |
| 94 | + value = "Enforce: Cluster is not publicly accessible" |
| 95 | +} |
| 96 | +``` |
| 97 | + |
| 98 | +Then re-apply the changes: |
| 99 | + |
| 100 | +```sh |
| 101 | +terraform plan |
| 102 | +terraform apply |
| 103 | +``` |
0 commit comments