Why won't Boto commands run in UserData when outbound traffic permissions are locked down?
NickName:Saqib Ali Ask DateTime:2015-06-11T07:59:15

Why won't Boto commands run in UserData when outbound traffic permissions are locked down?

I have a UserData script (in python) in an AWS Launch Configuration that’s associated with an AutoScale group. When new (ubuntu) instances are spun up this script is run on them to do whatever setup is needed.

Until now, I had the security groups configured more loosely. Outbound traffic to anywhere on the internet was allowed from these instances. The UserData script was working fine. But I just shut down that outbound rule to increase security. Now that UserData script randomly won’t execute at all or sometimes when it does execute, it fails. I can see this by examining the /var/log/cloud-init-output.log file. Has anyone seen this behavior? Any suggested solutions?

When the script fails, I can tell that it is failing on certain Boto calls that do network discovery such as boto.vpc.VPCConnection().get_all_vpcs(). It seems reasonable that this would fail if the outbound traffic rules prevent it from querying for this information. But what CIDR and port should I add to the security group rules that will allow Boto to do it's thing?

Below is what my Security Group's Egress rules look like when it doesn't work. The IP addresses are sensitive so I have blacked them out.

enter image description here

Below is what my Security Group's Egress rules look like when it works. As you can see I have allowed it to be open to the entire world. I feel like that's insecure. I want to lock it down.

enter image description here

You can see the /var/log/cloud-init-output.log file here when it fails.

You can see the associated /var/log/cloud-init.log file here.

Copyright Notice:Content Author:「Saqib Ali」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/30769355/why-wont-boto-commands-run-in-userdata-when-outbound-traffic-permissions-are-lo

More about “Why won't Boto commands run in UserData when outbound traffic permissions are locked down?” related questions

Why won't this code work?

Can anyone tell me why this code won't work? <?php $err=1; ?> <img src="334234234234234.gif" onError="<?php $err=0; ?>" /> <?php echo "<br /&a

Show Detail

Why won't this code work?

This is a simple actionscript code. Why won't it work? for (var inc = 1; inc <= 18; inc++) { current = "cb"+inc; current.addEventListener(Event.CHANGE, storedata); }

Show Detail

Why won't my macro variable resolve?

I have a macro variable, &myvar, but it won't resolve when I try to put it in a data step variable. Why won't it, and what can I do to fix this? %let myvar=Hello, world; data _null_; x='&

Show Detail

Why won't my macro variable resolve?

I have a macro variable, &myvar, but it won't resolve when I try to put it in a data step variable. Why won't it, and what can I do to fix this? %let myvar=Hello, world; data _null_; x='&

Show Detail

Why won't my macro variable resolve?

I have a macro variable, &myvar, but it won't resolve when I try to put it in a data step variable. Why won't it, and what can I do to fix this? %let myvar=Hello, world; data _null_; x='&

Show Detail

Why this .htaccess with 1 variable won't work?

I'm trying to get this but i really don't know why won't work. I try to change things and params and won't work: RewriteCond %{QUERY_STRING} board=([0-9]+).0 RewriteRule ^forum/index\.php$ index.php?

Show Detail

Why won't it print this variable?

So I'm doing this thing for math that requires a detailed algorithim. The thing is, it won't actually print the answer, and I don't know why. Essentially, the game that we have to find a strategy t...

Show Detail

Why won't ifstream open this file?

#include <iostream> #include <fstream> using namespace std; #define BRIGHTNESS_FILE "/sys/class/backlight/radeon_b10/brightness" int main() { ifstream brightness_file("

Show Detail

Why won't my DIV be 100% height?

I'm using Twitter's bootstrap "well" ID in a DIV and added my own "STYLE" in the HTML TAG but it won't seem to go 100% height? style="width:65%; height:100%; display:inline-block; margin-top:60px;...

Show Detail

Why won't this print out anything?

Why won't this print out anything, but it works if i just use (print "ASDAS") ,I'm using LightTable and It's printint out in the console. (defn try [x] (print ("ASDASD") )) (try 5)

Show Detail