AWS (EC2) Security Groups
Knocknoc can orchestrate Amazon AWS Security Groups, which essentially provide network level firewalling across various asset types, including EC2 VMs, meaning just-in-time network exposure (and access) for authenticated users, tied to your IDP not to AWS IAM or authentication
This is achieved by connecting a Knocknoc orchestration agent to your Knocknoc server, setting up a restricted AWS API user, then proceeding to the per-security-group configuration.
AWS configuration
IAM policy, user and access key
The Knocknoc orchestration agent requires a low number of AWS IAM privileges to add/remove IP addresses from existing firewalls, along with reading existing states. More recently AWS requires users to create-tags, which is also included below.
The broad process is: create the user and related (restricted) policy, then obtain an AWS access key for this user
- Log in to AWS
- Visit IAM -> Access Management -> Users and click "Create user"
- Provide a sensible name, this may be re-used across assets. Do not grant access to the AWS management console, this is not required.

- Select "Attach policies directly" if you are doing this for the first time, we need to create a policy. Otherwise select the existing Knoc policy.
- If using the Visual editor:
- If using JSON, you can merge this block in with the existing policy header/footer
{ "Sid": "VisualEditor0", "Effect": "Allow", "Action": [ "ec2:RevokeSecurityGroupIngress", "ec2:AuthorizeSecurityGroupEgress", "ec2:AuthorizeSecurityGroupIngress", "ec2:CreateTags", "ec2:RevokeSecurityGroupEgress", "ec2:DescribeSecurityGroups" ], "Resource": "*" } -
Optionally, you can also specify the IP address of the orchestration Agent(s) that may be using this access.
- Set a policy-name and click Create policy
- Return to your create-user page, and select the policy. This can be easily found by the "filter by type" drop down being "customer managed"
- Select the policy and click Next
- Click Create User.
Access key
You now need to create an access key for this user, which should be performed alongside the Knoc configuration (below) to copy/paste this information from AWS to Knocknoc, and ideally saved securely in your secret/vault for re-use later should it be required.
- Visit IAM -> Users -> "your-newly-created-user"
- Click on "Security credentials"
- Scroll down to "Access keys" and click "Create access key"
- Select "Command Line Interface (CLI)" and confirm "I understand", and click "Next"
- Click "Create access key" and optionally add a tag.
- Copy the "Access key" and "Secret access key" and save these for the Knoc configuration
- You are now complete.
Agent capability + AWS CLI
The orchestration agent granting access via Knocknoc requires the AWS CLI to function, this is provided by Amazon as operating system packages, as "awscli" in most distributions, eg: Redhat/Debian and derivatives.
Debian/Ubuntu: sudo apt-get install awscli
Redhat/etc yum install awscli
$ sudo apt-cache search awscli
awscli - Unified command line interface to Amazon Web Services
$ sudo apt-get install awscli
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
awscli
0 upgraded, 1 newly installed, 0 to remove and 11 not upgraded.
Need to get 0 B/8624 kB of archives.
After this operation, 96.5 MB of additional disk space will be used.
Selecting previously unselected package awscli.
(Reading database ... 69176 files and directories currently installed.)
Preparing to unpack .../awscli_2.9.19-1_all.deb ...
Unpacking awscli (2.9.19-1) ...
Setting up awscli (2.9.19-1) ...
Processing triggers for man-db (2.11.2-2) ...
Knoc configuration
Obtain the region information from here: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.RegionsAndAvailabilityZones.html#Concepts.RegionsAndAvailabilityZones.Regions







