Soracom Funk
Configuration
Enabling Funk will incur fees based on the number of requests made. Refer to the Pricing & Fee Schedule for more information.
Soracom Funk settings are found in Soracom Air or Soracom Inventory group settings.
Funk settings are shared among all device types within the same group. This means that you can configure Funk for one device type (cellular, Sigfox, LoRaWAN, or Inventory), and all other device types within that group will also use the same Funk settings.
If you want to use different Funk settings for different device types, simply create multiple groups each with different Funk settings, and assign your devices accordingly.
To configure Funk, open the settings page of the group that you want to configure.
Underneath the Basic Settings tab, click the SORACOM Funk panel to expand its settings.
Enable Funk by switching the option to ON.
You can then select the Service where you would like Funk to send data, and provide configuration parameters for the service.
Parameters
- Service - The cloud function provider where Funk will send data. Possible options are:
- AWS Lambda
- Azure Functions
- Google Cloud Functions
- Content type - The format of data being sent by your device.
- Credentials - The authentication credentials to use to connect to your cloud function. Use the
#{imsi}
or#{imei}
placeholders to automatically insert the subscriber IMSI or device IMEI in the field. - Function ARN or Function URL - The ARN or URL where your data will be sent, as configured in your cloud function.
When selecting the AWS Lambda service, you can also append :{VERSION}
to the end of the resourceUrl to specify which version of your function should be called.
When selecting the Google Cloud Functions service, the Credentials setting is not required. Refer to Google Cloud Functions documentation for different techniques to authenticate requests.
Multiple Credentials
When selecting the AWS Lambda or Azure Functions service, you must select an X.509 certificate in the Credentials parameter that Funk will use for authenticating the connection to your cloud function service. By default, selecting a single Credentials will tell Funk to use the same X.509 certificate credentials no matter which device is connecting to the Funk entry point.
You can alternatively use a #{imsi}
or #{imei}
placeholder variable in the Credentials parameter. When a device connects to the Funk entry point, Funk will subtitute the placeholder variable with the subscriber IMSI or device IMEI, and then use the credential set that matches the resulting ID.
For example, by registering the following X.509 certificates:
- Credentials Set 1
- ID -
device-295050012345678
- Credentials - X.509 certificate (certificate, private key, root CA)
- ID -
- Credentials Set 2
- ID -
device-295050012345679
- Credentials - X.509 certificate (certificate, private key, root CA)
- ID -
Then when the Credentials parameter is set to device-#{imsi}
, Funk will dynamically select the correct credential set when either device connects to the Funk entry point.
Default Credentials
In some situations, Funk will not be able to find matching Credentials. This may occur because you are using a new SIM or device, and have not yet registered a new set of X.509 certificates that will be used for that subscriber IMSI or device IMEI.
If Funk cannot find Credentials that match the ID, it will then replace the #{imsi}
or #{imei}
placeholder variable with the string default
and attempt to find a credential set that matches the resulting ID. In the example above, if a device using a SIM with IMSI 295050012345680
connects to the Funk entry point, Funk will not be able to find any credential sets that match the device-295050012345680
ID, and will instead look for a credential set that matches the device-default
ID.
By registering a Default Credential, you can ensure that devices are still able to securely connect to your cloud function service. Depending on your cloud function, you may choose to enforce specific security policies associated with this default credential.
When using the #{imsi}
placeholder, Funk will always be able to infer the subscriber IMSI. The default
string is used only when a credential set that matches the ID is not found.
On the other hand, when using the #{imei}
placeholder, the default
string will be used in both of the following situations:
- The device IMEI is reported from the network, but a matching credential set is not found.
- The device IMEI is not reported from the network.
Advanced Configuration
Funk can also be configured through the Soracom API or CLI by using the SoracomFunk namespace.
Configuration Structure
"SoracomFunk": {
"enabled": true|false,
"destination": {
"provider": "aws"|"azure"|"google",
"service": "lambda"|"function-app"|"cloud-functions",
"resourceUrl": "https://example.com/path/to/resource"
},
"credentialsId": {
"$credentialsId": "my-credentials",
},
"contentType": "unspecified"|"application/json"|"text"|"binary"
}
Parameters
Enable or disable Funk:
- key (string, required) -
enabled
- value (boolean, default:
false
) - Enables or disables Funk.
Modify the Funk destination:
- key (string, required) -
destination
- value (object, required) - Destination configuration.
- provider (string, required) - Select the destination provider. Valid options:
"aws"
,"azure"
, and"google"
. - service (string, required) - Select the destination service. The service must correspond to the provider. Valid options:
"lambda"
,"function-app"
, or"cloud-functions"
. - resourceUrl (string, required) - The resource ARN or function URL.
- provider (string, required) - Select the destination provider. Valid options:
Modify credentials to use for authentication (this parameter has no effect when using Google Cloud Functions):
- key (string, required) -
$credentialsId
- value (string, required) - The ID of the Credentials Set to use for authentication. Use the
#{imsi}
or#{imei}
placeholders to automatically insert the subscriber IMSI or device IMEI in the field.
Modify data processing behavior:
- key (string, required) -
contentType
- value (string, default:
"json"
) - Specifies processing to be applied to user data contained in payloads. Valid options:"unspecified"
,"application/json"
,"text"
, or"binary"
. When set to JSON, data will be parsed as JSON.
Sample configurations
For AWS Lambda:
[
{
"key": "enabled",
"value": true
},
{
"key": "destination",
"value": {
"provider": "aws",
"service": "lambda",
"resourceUrl": "arn:aws:lambda:us-east-1:900012345678:function:my-lambda-function"
}
},
{
"key": "$credentialsId",
"value": {
"my-aws-credentials"
}
},
{
"key": "contentType",
"value": "application/json"
}
]