2016-05-03 16 views
5

boto3を使用してセキュリティグループルールを更新しようとしています。セキュリティグループb(sg_a)boto3 authorize_security_group_ingressを使用して、デフォルト以外のVPC内の2つのセキュリティグループ間にルールを追加する方法

botocore.exceptions.ClientError: An error occurred (VPCIdNotSpecified) when calling the AuthorizeSecurityGroupIngress operation: No default VPC for this user. 

にはどうすればauthoriを使用してください:)私は、次の

ec2.authorize_security_group_ingress(
     GroupId=sg_a, 
     SourceSecurityGroupName=sg_b, 
     IpProtocol='tcp', 
     FromPort=service_port, 
     ToPort=service_port 
    ) 

でこれを達成するためにEC2クライアントを使用しようとしていますが、私はこのエラーを得たポート8443

にアクセスするにはデフォルト以外のVPCの場合はze_security_group_igress?

+0

ec2.authorize_security_group_ingress( GroupId=sg_a, IpPermissions=[ {'IpProtocol': 'tcp', 'FromPort': from_port, 'ToPort': to_port, 'UserIdGroupPairs': [{ 'GroupId': sg_b }] } ], ) 
[ドキュメントヘルプできる(http://boto3.readthedocs.io/en/latest/reference/services/ec2.html#EC2.Client.authorize_security_group_ingress) – hangtwenty

+1

正しい構文は次のとおり 'ec2.authorize_security_group_ingress( グループID = sg_a、 IpPermissions = [{ 'IPプロトコル': 'TCP' 'FROMPORT':from_port、 'ToPort':to_port、 'UserIdGroupPairs' :[{ 'GroupId':sg_b }] }]、 ) ' – blindstack

+0

解決策を記入し、解決済みと記入してください。 – mootmoot

答えて

関連する問題