Given DeviceTypes, DeviceBlueprints and SystemBlueprints have no knowledge of the underlying devices and can refer to multiple different AWS resources, Sputnik has a "meta-language" in order to map these resources updon deployment.
The deployment service supports the following tags that are pre-populated at first sputnik deployment in your account:
- AWS_ACCOUNT
- AWS_REGION
- THING_NAME
- CORE
- CORE_ARN
- CORE_CERTIFICATE_ARN
- DATA_BUCKET
- DATA_BUCKET_S3_URL
- IOT_ENDPOINT
These account related metadata are used in the specs by encapsulating them in brackets [ ].
Example: ml-demo-squeezenet-v1.0
{
"FunctionDefinitionVersion": {
"Functions": [{
"FunctionArn": "arn:aws:lambda:[AWS_REGION]:[AWS_ACCOUNT]:function:sputnik-gg-ml-inference-squeezenet-demo-python:Prod",
"FunctionConfiguration": {
...
In the DeviceBlueprints, some fields require to map to a specific DeviceType. For this the deviceTypeMappings object is used.
Example: ml-demo-squeezenet-v1.0
{
"FunctionDefinitionVersion": {
"Functions": [{
"FunctionArn": "arn:aws:lambda:[AWS_REGION]:[AWS_ACCOUNT]:function:sputnik-gg-ml-inference-squeezenet-demo-python:Prod",
"FunctionConfiguration": {
...
}
}]
}...
}
In this sample. CAM_STREAM_ID_1 will be replaced by picamera-vcsm for the rpi3-sense-hat-picamera-v1.0 DeviceType.
This metadata tag in the specs allows to pull data from inferred data from a SystemBlueprint.
A system can consist of 2 devices. In a SystemBlueprint these 2 devices are referenced by the ref tag.
By using the !GetAtt, upon deployment, we can reference information from the very specific device that is referenced by the system form the blueprint.
Example: sample-system-v1.0
{
"Devices": [{
...
"ref": "DEVICE",
"spec": {
"FunctionDefinitionVersion": {
"Functions": [{
...
}, {
"FunctionArn": "arn:aws:lambda:[AWS_REGION]:[AWS_ACCOUNT]:function:sputnik-simple-greengrass-device-demo-python:Prod",
"FunctionConfiguration": {
"EncodingType": "json",
"Environment": {
"Variables": {
...
"GATEWAY": "!GetAtt[GATEWAY.thingName]",
...
...
}, {
...
"ref": "GATEWAY",
"spec": {
...
}
}
}
}