O'Reilly logo

Salt Cookbook by Anirban Saha

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Implementing security groups

Before compute resources can be configured, it is extremely important to configure the proper security measures to be taken to avoid unwanted access. In this recipe, we will learn about how to configure security groups using Salt in AWS.

How to do it...

  1. Configure a new state called aws in the production environment. Create /opt/ salt-cookbook/production/aws/secgroup.sls to have the following entries:
    cookbooksecgroup:
        boto_secgroup.present:
            - description: Cookbook security group
            - rules:
                - ip_protocol: tcp
                  from_port: 80
                  to_port: 80
                  cidr_ip:
                    - 172.31.0.0/20
                    - 172.31.16.0/20
            - vpc_id: vpc-45f53420
            - region: us-west-2
            - keyid: <access-key>
            - key: '<secret-key>'
  2. Apply the state to the Salt master by running the following command: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required