Update Security Groups Automatically Using AWS Lambda

Go to Lab

429 Reviews

louis bohm

louis b. · Reviewed about 9 hours ago

Pedro Nova

Pedro N. · Reviewed about 11 hours ago

Dennison Gray

Fun lab!!! FYI, ran into an unexpected error towards the bottom of this output. Looks like it's hitting some limit. : a5c246: Adding 13.32.0.0/15:80 sg-23a5c246: Adding 13.54.63.128/26:80 sg-23a5c246: Adding 34.195.252.0/24:80 sg-23a5c246: Adding 35.162.63.192/26:80 sg-23a5c246: Adding 35.167.191.128/26:80 sg-23a5c246: Adding 52.15.127.128/26:80 sg-23a5c246: Adding 52.46.0.0/18:80 sg-23a5c246: Adding 52.52.191.128/26:80 sg-23a5c246: Adding 52.56.127.0/25:80 sg-23a5c246: Adding 52.57.254.0/24:80 sg-23a5c246: Adding 52.66.194.128/26:80 sg-23a5c246: Adding 52.78.247.128/26:80 sg-23a5c246: Adding 52.84.0.0/15:80 sg-23a5c246: Adding 52.199.127.192/26:80 sg-23a5c246: Adding 52.212.248.0/26:80 sg-23a5c246: Adding 52.220.191.0/26:80 sg-23a5c246: Adding 52.222.128.0/17:80 sg-23a5c246: Adding 54.182.0.0/16:80 sg-23a5c246: Adding 54.192.0.0/16:80 sg-23a5c246: Adding 54.230.0.0/16:80 sg-23a5c246: Adding 54.233.255.128/26:80 sg-23a5c246: Adding 54.239.128.0/18:80 sg-23a5c246: Adding 54.239.192.0/19:80 sg-23a5c246: Adding 54.240.128.0/18:80 sg-23a5c246: Adding 204.246.164.0/22:80 sg-23a5c246: Adding 204.246.168.0/22:80 sg-23a5c246: Adding 204.246.174.0/23:80 sg-23a5c246: Adding 204.246.176.0/20:80 sg-23a5c246: Adding 205.251.192.0/19:80 sg-23a5c246: Adding 205.251.249.0/24:80 sg-23a5c246: Adding 205.251.250.0/23:80 sg-23a5c246: Adding 205.251.252.0/23:80 sg-23a5c246: Adding 205.251.254.0/24:80 sg-23a5c246: Adding 216.137.32.0/19:80 sg-23a5c246: Adding 13.32.0.0/15:443 sg-23a5c246: Adding 13.54.63.128/26:443 sg-23a5c246: Adding 34.195.252.0/24:443 sg-23a5c246: Adding 35.162.63.192/26:443 sg-23a5c246: Adding 35.167.191.128/26:443 sg-23a5c246: Adding 52.15.127.128/26:443 sg-23a5c246: Adding 52.46.0.0/18:443 sg-23a5c246: Adding 52.52.191.128/26:443 sg-23a5c246: Adding 52.56.127.0/25:443 sg-23a5c246: Adding 52.57.254.0/24:443 sg-23a5c246: Adding 52.66.194.128/26:443 sg-23a5c246: Adding 52.78.247.128/26:443 sg-23a5c246: Adding 52.84.0.0/15:443 sg-23a5c246: Adding 52.199.127.192/26:443 sg-23a5c246: Adding 52.212.248.0/26:443 sg-23a5c246: Adding 52.220.191.0/26:443 sg-23a5c246: Adding 52.222.128.0/17:443 sg-23a5c246: Adding 54.182.0.0/16:443 sg-23a5c246: Adding 54.192.0.0/16:443 sg-23a5c246: Adding 54.230.0.0/16:443 sg-23a5c246: Adding 54.233.255.128/26:443 sg-23a5c246: Adding 54.239.128.0/18:443 sg-23a5c246: Adding 54.239.192.0/19:443 sg-23a5c246: Adding 54.240.128.0/18:443 sg-23a5c246: Adding 204.246.164.0/22:443 sg-23a5c246: Adding 204.246.168.0/22:443 sg-23a5c246: Adding 204.246.174.0/23:443 sg-23a5c246: Adding 204.246.176.0/20:443 sg-23a5c246: Adding 205.251.192.0/19:443 sg-23a5c246: Adding 205.251.249.0/24:443 sg-23a5c246: Adding 205.251.250.0/23:443 sg-23a5c246: Adding 205.251.252.0/23:443 sg-23a5c246: Adding 205.251.254.0/24:443 sg-23a5c246: Adding 216.137.32.0/19:443 An error occurred (RulesPerSecurityGroupLimitExceeded) when calling the AuthorizeSecurityGroupIngress operation: The maximum number of rules per security group has been reached.: ClientError Traceback (most recent call last): File "/var/task/lambda_function.py", line 31, in lambda_handler result = update_security_groups(cf_ranges) File "/var/task/lambda_function.py", line 69, in update_security_groups if update_security_group(client, group, new_ranges): File "/var/task/lambda_function.py", line 108, in update_security_group added += add_permissions(client, group, permission, to_add) File "/var/task/lambda_function.py", line 136, in add_permissions client.authorize_security_group_ingress(GroupId=group['GroupId'], IpPermissions=[add_params]) File "/var/runtime/botocore/client.py", line 253, in _api_call return self._make_api_call(operation_name, kwargs) File "/var/runtime/botocore/client.py", line 543, in _make_api_call raise error_class(parsed_response, operation_name) ClientError: An error occurred (RulesPerSecurityGroupLimitExceeded) when calling the AuthorizeSecurityGroupIngress operation: The maximum number of rules per security group has been reached. END RequestId: 75cfa37c-2b66-11e7-93fa-e1b94379d2e7 REPORT RequestId: 75cfa37c-2b66-11e7-93fa-e1b94379d2e7 Duration: 2554.55 ms Billed Duration: 2600 ms Memory Size: 128 MB Max Memory Used: 54 MB

Dennison G. · Reviewed 1 day ago

Mark Lewis

Got an error that said that the number of rules in the security group had been exceeded (when testing the Lambda function).

Mark L. · Reviewed 1 day ago

sandeep maram

sandeep m. · Reviewed 2 days ago

Frank Waryan

still had some difficulty, will continue forward

Frank W. · Reviewed 2 days ago

Brandon English

Brandon E. · Reviewed 3 days ago

James Cone

James C. · Reviewed 3 days ago

Frank Waryan

there was some corruption

Frank W. · Reviewed 3 days ago

Joe Deutsch

FUnction did not run

Joe D. · Reviewed 3 days ago

srikanth nutigattu

srikanth n. · Reviewed 4 days ago

Adam Courson

Adam C. · Reviewed 4 days ago

anthony bondu

anthony b. · Reviewed 4 days ago

George Smith

Lambda function fails with the following error. An error occurred (RulesPerSecurityGroupLimitExceeded) when calling the AuthorizeSecurityGroupIngress operation: The maximum number of rules per security group has been reached.: ClientError

George S. · Reviewed 4 days ago

Jeyaram Ayyalusamuy

Jeyaram A. · Reviewed 4 days ago

Roshan Kothari

Roshan K. · Reviewed 4 days ago

Roshan Kothari

Roshan K. · Reviewed 4 days ago

ecloudvalley lab

ecloudvalley l. · Reviewed 5 days ago

bo bo

bo b. · Reviewed 6 days ago

Nakao  Yuichiro

Nakao Y. · Reviewed 6 days ago

Richard Barretto

The lab was very confusing.

Richard B. · Reviewed 8 days ago

Grig Gheorghiu

Grig G. · Reviewed 8 days ago

wei liu

wei l. · Reviewed 9 days ago

Aneesh Jose

Aneesh J. · Reviewed 9 days ago

Pradeep Singh

Pradeep S. · Reviewed 10 days ago