private void authorizeClassicDbSecurityGroup ( String groupName , String sourceCidr ) throws CloudException , InternalException { Map < String , String > parameters = getProvider ( ) . getStandardRdsParameters ( getProvider ( ) . getContext ( ) , AUTHORIZE_DB_SECURITY_GROUP_INGRESS ) ; parameters . put ( "DBSecurityGroupName" , groupName ) ; parameters . put ( "CIDRIP" , sourceCidr ) ; EC2Method method = new EC2Method ( SERVICE_ID , getProvider ( ) , parameters ) ; try { method . invoke ( ) ; } catch ( EC2Exception e ) { String code = e . getCode ( ) ; if ( code != null && code . equals ( "AuthorizationAlreadyExists" ) ) { return ; } throw new CloudException ( e ) ; } }
Use this to authorize with security groups in EC2 - Classic