Equivalent of FMGCPVirtualNetwork set_assign_public_ip in FMAWSVirtualNetwork

Abdoulaye
Abdoulaye Dataiku DSS Core Designer, Registered Posts: 45 ✭✭✭✭✭
edited July 16 in Using Dataiku

Hello, I've used

FMAWSVirtualNetwork(FMVirtualNetwork)

to create and manage virtual network in fleet manager, I'm looking for a setting that is equivalent in gcp to not assign a public ip address to instance once they are created using templated network.

Based on dataikuapi, I can see clearly that this exist for gcp in this class

FMGCPVirtualNetwork(FMVirtualNetwork)

but in aws I can how to set false in settings, is there any equivalent parameter to set to false or None when using FMAWSVirtualNetwork(FMVirtualNetwork)?

Thanks

Best Answer

  • Zach
    Zach Dataiker, Dataiku DSS Core Designer, Dataiku DSS Adv Designer, Registered Posts: 153 Dataiker
    edited July 17 Answer ✓

    Hi @abdoulaye
    ,

    You can change this setting for FMAWSVirtualNetwork by directly setting the "awsAssignPublicIP" field. For example:

    import dataikuapi
    
    client = dataikuapi.FMClientAWS(HOST, KEY_ID, KEY_SECRET)
    
    # Get an existing virtual network
    virtual_network = client.get_virtual_network(VIRTUAL_NETWORK_ID)
    
    # Disable assigning public IPs
    virtual_network.vn_data["awsAssignPublicIP"] = False
    virtual_network.save()

Answers

  • Abdoulaye
    Abdoulaye Dataiku DSS Core Designer, Registered Posts: 45 ✭✭✭✭✭
    edited July 17

    Hi I want to do the same for this checkbox "Use private IP". What the exact key?

    tpl = client.get_instance_template('ist-xxxxxxx')
    tpl.ist_data["setupActions"]['Use private IP']

    Thanks

  • Zach
    Zach Dataiker, Dataiku DSS Core Designer, Dataiku DSS Adv Designer, Registered Posts: 153 Dataiker
    edited July 17

    Hi @abdoulaye
    ,

    Instance templates can have multiple setup actions, so first you'll need to find the setup action that's the right type (SETUP_K8S_AND_SPARK).

    Then you can set the use_private_ip param on the setup action.

    Example:

    import dataikuapi
    
    client = dataikuapi.FMClientAWS(HOST, KEY_ID, KEY_SECRET)
    tpl = client.get_instance_template("ist-xxxxxxxxxxxx")
    
    setup_actions = tpl.ist_data["setupActions"]
    print("setupActions:", setup_actions)
    
    # Get the first setup action where the type is "SETUP_K8S_AND_SPARK"
    k8s_setup_action = next(a for a in setup_actions if a["type"] == "SETUP_K8S_AND_SPARK")
    
    k8s_setup_action["params"]["use_private_ip"] = True
    tpl.save()

  • Abdoulaye
    Abdoulaye Dataiku DSS Core Designer, Registered Posts: 45 ✭✭✭✭✭
  • Abdoulaye
    Abdoulaye Dataiku DSS Core Designer, Registered Posts: 45 ✭✭✭✭✭
    edited July 17

    Hi I was not able to set value directly using:

    k8s_setup_action["params"]["use_private_ip"] = Tru

    I used first to set the dict

    k8s_setup_action['params'] = {}
    k8s_setup_action["params"]["use_private_ip"] = True

    there was no default params for params.

Setup Info
    Tags
      Help me…