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: ...

Get Salt Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.