lundi 1 juin 2015

AWS JS SDK AuthorizeSecurityGroupIngress VPC Error

I'm trying to add a self-referencing rule to my security group using the AWS JS SDK (http://ift.tt/1LXRfMZ). I'm able to add other TCP rules without any issues, only the source security group is giving me issues. Here is a snippet of my script.

var params = {
    GroupId: data['GroupId'],
    FromPort: 0,
    ToPort: 65535,
    SourceSecurityGroupName: data['GroupId']
};                            
ec2.authorizeSecurityGroupIngress(params, function(err, data) {
    if (err) console.log(err, err.stack); // an error occurred
    else console.log(data); // successful response
});

And this is the error is gives me.

{ [InvalidGroup.NotFound: The security group 'sg-e56a6681' does not exist in default VPC 'vpc-64409e01']
  message: 'The security group \'sg-e56a6681\' does not exist in default VPC \'vpc-64409e01\'',
  code: 'InvalidGroup.NotFound',
  time: Mon Jun 01 2015 15:02:48 GMT-0400 (EDT),
  statusCode: 400,
  retryable: false,
  retryDelay: 30 }

The security group is indeed NOT in the default VPC, but according to the documentation, if I specify the GroupId, it's ok. And what's really weird is, the same request works in AWS CLI

aws ec2 authorize-security-group-ingress --group-id sg-e56a6681 --protocol tcp --source-group sg-e56a6681 --port 0-65535 --output json

Any idea why this is happening?




Aucun commentaire:

Enregistrer un commentaire