Skip to content

Instantly share code, notes, and snippets.

@nhajratw
Last active August 29, 2015 14:01
Show Gist options
  • Save nhajratw/f09291aa942a4fa8d860 to your computer and use it in GitHub Desktop.
Save nhajratw/f09291aa942a4fa8d860 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
#
#
require 'net/http'
my_ip = Net::HTTP.get(URI('http://icanhazip.com'))
system "aws ec2 authorize-security-group-ingress --group-id sg-2f666d4d --protocol all --cidr #{my_ip}/32"
#######
# The error i get is:
#
# A client error (InvalidParameterValue) occurred when calling the AuthorizeSecurityGroupIngress operation: invalid CIDR subnet specification: 70.210.77.66
# sh: line 1: /32: No such file or directory
#
# Seems like it's trying to parse the /32 as a seperate command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment