instances

SSM send command to EC2 instance Failed

余生长醉 提交于 2019-12-03 07:26:40
I'm trying to use boto3 to run ssh commands on EC2 instances. I read this guide: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/troubleshooting-remote-commands.html and I did everything of what they wrote there but I keep get error message: >>>import boto3 >>> ec2 = boto3.client('ssm') >>> a = ec2.send_command(InstanceIds=['i-0d5e16f6'], DocumentName='AWS-RunShellScript', Comment='abcdabcd', Parameters={"commands":["ifconfig"]}) output: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python2.7/dist-packages/botocore/client.py", line 253, in _api

TypeScript class decorator that modifies object instance

邮差的信 提交于 2019-12-03 06:46:23
I'm making a plugin for Aurelia and need a class decorator that adds attributes to the new object instance, and calls an external function with the new object as an argument. I've looked through examples, and so far I've put together ("pseudo-ish" code) return function addAndCall(target: any): any { var original = target; var newConstructor = function (...args) { original.apply(this, args); this.newAttribute = "object instance value"; ExternalModule.externalFunction(this); }; newConstructor.prototype = Object.create(original.prototype); newConstructor.prototype.constructor = original; return

Detect number of processes running with the same name

…衆ロ難τιáo~ 提交于 2019-12-03 03:22:01
Any ideas of how to write a function that returns the number of instances of a process is running? Perhaps something like this? function numInstances([string]$process) { $i = 0 while(<we can get a new process with name $process>) { $i++ } return $i } Edit: Started to write a function... It works for a single instance but it goes into an infinite loop if more than one instance is running: function numInstances([string]$process) { $i = 0 $ids = @() while(((get-process $process) | where {$ids -notcontains $_.ID}) -ne $null) { $ids += (get-process $process).ID $i++ } return $i } function

Factory Pattern: typedef Class *(createClassFunction)(void)

佐手、 提交于 2019-12-02 17:16:28
问题 What does typedef Class *(createClassFunction)(void) (or another variation is typedef Class* (__stdcall *CreateClassFunction)(void) )stand for? What does it mean? How am I supposed to explain it? Especially in the context of Factory Patterns... 回答1: Reading C type expressions createClassFunction is a typedef for a function taking no arguments and returning a Class * . With that declaration, a pointer to such a funciton can obviously act as factory for a Class . Usage might be as follows: //

Factory Pattern: typedef Class *(createClassFunction)(void)

若如初见. 提交于 2019-12-02 08:53:56
What does typedef Class *(createClassFunction)(void) (or another variation is typedef Class* (__stdcall *CreateClassFunction)(void) )stand for? What does it mean? How am I supposed to explain it? Especially in the context of Factory Patterns... Reading C type expressions createClassFunction is a typedef for a function taking no arguments and returning a Class * . With that declaration, a pointer to such a funciton can obviously act as factory for a Class . Usage might be as follows: // the class factory Class * MostTrivialFactoryKnownToMan() { return new Class; } // another class factory Class

How do I reference instances using an instance?

非 Y 不嫁゛ 提交于 2019-12-02 04:50:12
I'm trying to minimize how much I create an instance, as I am not particularly skilled in Java. Currently I have a set of instances of other classes in my Main, a quick example... public final class ClassName extends JavaPlugin { AntiSwear antiSwear = new AntiSwear(); Spam spam = new Spam(); @Override public void onEnable() { // Plugin startup logic } @Override public void onDisable() { // Plugin shutdown logic } } And instead of making more and more instances, I just want to make an instance of the main class, ClassName className = new ClassName(); and run something like className.spam...

“Global variable” in Visual C#

旧时模样 提交于 2019-12-02 03:17:22
I have made the Graph class, and i want to simulate a distribution network. The Graph works 100%. But, i want to use that same struct/class in all my application! For example: I have Form1 that shows the simulation, but i want to insert Nodes (for example) but i want to do it in Form2! Since the data is always in the same class, i could make my Graph instance global but C# does not take global variables. So, how would i solve this? Any ideas? Thank you! Give the forms a reference to the Graph in their constructor. Graph g = new Graph(); Form1 f1 = new Form1(g); Form2 f2 = new Form2(g); Then

App Engine - Too many open instances

女生的网名这么多〃 提交于 2019-11-30 15:08:46
问题 My app is running on App engine Java SDK, and since this morning I noticed that open instances are not handling new requests, and instead, new Frontent instances are being started. So now i have about 250 open instances (a lot more than usual). Also, the instances are running on version 1.9.5. Please advice! 回答1: The issue has been fixed by Google at 2014-05-09 10:15 (US Pacific Time). See Google App Engine Downtime Notify How we fixed the issue temporarily: Disable and re-enable the

App Engine - Too many open instances

天大地大妈咪最大 提交于 2019-11-30 13:57:38
My app is running on App engine Java SDK, and since this morning I noticed that open instances are not handling new requests, and instead, new Frontent instances are being started. So now i have about 250 open instances (a lot more than usual). Also, the instances are running on version 1.9.5. Please advice! The issue has been fixed by Google at 2014-05-09 10:15 (US Pacific Time). See Google App Engine Downtime Notify How we fixed the issue temporarily: Disable and re-enable the application inside the Application Settings. After doing this everything went back to normal. Since then we only saw

Obtaining tags from AWS instances with boto

自闭症网瘾萝莉.ら 提交于 2019-11-30 11:11:28
I'm trying to obtain tags from instances in my AWS account using Python's boto library. While this snippet works correctly bringing all tags: tags = e.get_all_tags() for tag in tags: print tag.name, tag.value (e is an EC2 connection) When I request tags from individual instances, print vm.__dict__['tags'] or print vm.tags I'm getting an empty list (vm is actually an instance class). The following code: vm.__dict__['tags']['Name'] of course results in: KeyError: 'Name' My code was working until yesterday and suddenly I'm not able to get the tags from an instance. Does anybody know whether there