Skip to content

Commit

Permalink
Added new debug feature for security group creation
Browse files Browse the repository at this point in the history
  • Loading branch information
mcianfrocco committed Jul 2, 2017
1 parent c18716f commit cfc4e33
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions aws/launch_AWS_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,11 @@ def launchInstance(params,keyName,keyPath,AMI,AWS_ACCOUNT_ID):
print 'Error: Too many security groups. Exiting\n'
sys.exit()

if params['debug'] is True:
print 'aws ec2 create-security-group --group-name %s --vpc-id %s --description "%s" | grep GroupId' %(securityGroupName,VPC,securityGroupDescript)
print subprocess.Popen('aws ec2 create-security-group --group-name %s --vpc-id %s --description "%s"'%(securityGroupName,VPC,securityGroupDescript), shell=True, stdout=subprocess.PIPE).stdout.read().strip()
print subprocess.Popen('aws ec2 create-security-group --group-name %s --vpc-id %s --description "%s" | grep GroupId' %(securityGroupName,VPC,securityGroupDescript), shell=True, stdout=subprocess.PIPE).stdout.read().strip()

securityGroupId=subprocess.Popen('aws ec2 create-security-group --group-name %s --vpc-id %s --description "%s" | grep GroupId' %(securityGroupName,VPC,securityGroupDescript), shell=True, stdout=subprocess.PIPE).stdout.read().strip().split()[-1].split('"')[1]

if params['debug'] is True:
Expand Down

0 comments on commit cfc4e33

Please sign in to comment.