GreengrassV2.Client.
create_component_version
(**kwargs)¶Creates a component. Components are software that run on Greengrass core devices. After you develop and test a component on your core device, you can use this operation to upload your component to IoT Greengrass. Then, you can deploy the component to other core devices.
You can use this operation to do the following:
inlineRecipe
when you call this operation.python2.7
python3.7
python3.8
python3.9
java8
java11
nodejs10.x
nodejs12.x
nodejs14.x
To create a component from a Lambda function, specify lambdaFunction
when you call this operation.
Note
IoT Greengrass currently supports Lambda functions on only Linux core devices.
See also: AWS API Documentation
Request Syntax
response = client.create_component_version(
inlineRecipe=b'bytes',
lambdaFunction={
'lambdaArn': 'string',
'componentName': 'string',
'componentVersion': 'string',
'componentPlatforms': [
{
'name': 'string',
'attributes': {
'string': 'string'
}
},
],
'componentDependencies': {
'string': {
'versionRequirement': 'string',
'dependencyType': 'HARD'|'SOFT'
}
},
'componentLambdaParameters': {
'eventSources': [
{
'topic': 'string',
'type': 'PUB_SUB'|'IOT_CORE'
},
],
'maxQueueSize': 123,
'maxInstancesCount': 123,
'maxIdleTimeInSeconds': 123,
'timeoutInSeconds': 123,
'statusTimeoutInSeconds': 123,
'pinned': True|False,
'inputPayloadEncodingType': 'json'|'binary',
'execArgs': [
'string',
],
'environmentVariables': {
'string': 'string'
},
'linuxProcessParams': {
'isolationMode': 'GreengrassContainer'|'NoContainer',
'containerParams': {
'memorySizeInKB': 123,
'mountROSysfs': True|False,
'volumes': [
{
'sourcePath': 'string',
'destinationPath': 'string',
'permission': 'ro'|'rw',
'addGroupOwner': True|False
},
],
'devices': [
{
'path': 'string',
'permission': 'ro'|'rw',
'addGroupOwner': True|False
},
]
}
}
}
},
tags={
'string': 'string'
},
clientToken='string'
)
The recipe to use to create the component. The recipe defines the component's metadata, parameters, dependencies, lifecycle, artifacts, and platform compatibility.
You must specify either inlineRecipe
or lambdaFunction
.
The parameters to create a component from a Lambda function.
You must specify either inlineRecipe
or lambdaFunction
.
The ARN of the Lambda function. The ARN must include the version of the function to import. You can't use version aliases like $LATEST
.
The name of the component.
Defaults to the name of the Lambda function.
The version of the component.
Defaults to the version of the Lambda function as a semantic version. For example, if your function version is 3
, the component version becomes 3.0.0
.
The platforms that the component version supports.
Contains information about a platform that a component supports.
The friendly name of the platform. This name helps you identify the platform.
If you omit this parameter, IoT Greengrass creates a friendly name from the os
and architecture
of the platform.
A dictionary of attributes for the platform. The IoT Greengrass Core software defines the os
and architecture
by default. You can specify additional platform attributes for a core device when you deploy the Greengrass nucleus component. For more information, see the Greengrass nucleus component in the IoT Greengrass V2 Developer Guide .
The component versions on which this Lambda function component depends.
Contains information about a component dependency for a Lambda function component.
The component version requirement for the component dependency.
IoT Greengrass V2 uses semantic version constraints. For more information, see Semantic Versioning.
The type of this dependency. Choose from the following options:
SOFT
– The component doesn't restart if the dependency changes state.HARD
– The component restarts if the dependency changes state.Default: HARD
The system and runtime parameters for the Lambda function as it runs on the Greengrass core device.
The list of event sources to which to subscribe to receive work messages. The Lambda function runs when it receives a message from an event source. You can subscribe this function to local publish/subscribe messages and Amazon Web Services IoT Core MQTT messages.
Contains information about an event source for an Lambda function. The event source defines the topics on which this Lambda function subscribes to receive messages that run the function.
The topic to which to subscribe to receive event messages.
The type of event source. Choose from the following options:
PUB_SUB
– Subscribe to local publish/subscribe messages. This event source type doesn't support MQTT wildcards ( +
and #
) in the event source topic.IOT_CORE
– Subscribe to Amazon Web Services IoT Core MQTT messages. This event source type supports MQTT wildcards ( +
and #
) in the event source topic.The maximum size of the message queue for the Lambda function component. The IoT Greengrass core stores messages in a FIFO (first-in-first-out) queue until it can run the Lambda function to consume each message.
The maximum number of instances that a non-pinned Lambda function can run at the same time.
The maximum amount of time in seconds that a non-pinned Lambda function can idle before the IoT Greengrass Core software stops its process.
The maximum amount of time in seconds that the Lambda function can process a work item.
The interval in seconds at which a pinned (also known as long-lived) Lambda function component sends status updates to the Lambda manager component.
Whether or not the Lambda function is pinned, or long-lived.
maxIdleTimeInSeconds
. If the function has multiple work items, the IoT Greengrass Core software creates multiple instances of the function.Default: true
The encoding type that the Lambda function supports.
Default: json
The list of arguments to pass to the Lambda function when it runs.
The map of environment variables that are available to the Lambda function when it runs.
The parameters for the Linux process that contains the Lambda function.
The isolation mode for the process that contains the Lambda function. The process can run in an isolated runtime environment inside the IoT Greengrass container, or as a regular process outside any container.
Default: GreengrassContainer
The parameters for the container in which the Lambda function runs.
The memory size of the container, expressed in kilobytes.
Default: 16384
(16 MB)
Whether or not the container can read information from the device's /sys
folder.
Default: false
The list of volumes that the container can access.
Contains information about a volume that Linux processes in a container can access. When you define a volume, the IoT Greengrass Core software mounts the source files to the destination inside the container.
The path to the physical volume in the file system.
The path to the logical volume in the file system.
The permission to access the volume: read/only ( ro
) or read/write ( rw
).
Default: ro
Whether or not to add the IoT Greengrass user group as an owner of the volume.
Default: false
The list of system devices that the container can access.
Contains information about a device that Linux processes in a container can access.
The mount path for the device in the file system.
The permission to access the device: read/only ( ro
) or read/write ( rw
).
Default: ro
Whether or not to add the component's system user as an owner of the device.
Default: false
A list of key-value pairs that contain metadata for the resource. For more information, see Tag your resources in the IoT Greengrass V2 Developer Guide .
A unique, case-sensitive identifier that you can provide to ensure that the request is idempotent. Idempotency means that the request is successfully processed only once, even if you send the request multiple times. When a request succeeds, and you specify the same client token for subsequent successful requests, the IoT Greengrass V2 service returns the successful response that it caches from the previous request. IoT Greengrass V2 caches successful responses for idempotent requests for up to 8 hours.
This field is autopopulated if not provided.
dict
Response Syntax
{
'arn': 'string',
'componentName': 'string',
'componentVersion': 'string',
'creationTimestamp': datetime(2015, 1, 1),
'status': {
'componentState': 'REQUESTED'|'INITIATED'|'DEPLOYABLE'|'FAILED'|'DEPRECATED',
'message': 'string',
'errors': {
'string': 'string'
},
'vendorGuidance': 'ACTIVE'|'DISCONTINUED'|'DELETED',
'vendorGuidanceMessage': 'string'
}
}
Response Structure
(dict) --
arn (string) --
The ARN of the component version.
componentName (string) --
The name of the component.
componentVersion (string) --
The version of the component.
creationTimestamp (datetime) --
The time at which the component was created, expressed in ISO 8601 format.
status (dict) --
The status of the component version in IoT Greengrass V2. This status is different from the status of the component on a core device.
componentState (string) --
The state of the component version.
message (string) --
A message that communicates details, such as errors, about the status of the component version.
errors (dict) --
A dictionary of errors that communicate why the component version is in an error state. For example, if IoT Greengrass can't access an artifact for the component version, then errors
contains the artifact's URI as a key, and the error message as the value for that key.
vendorGuidance (string) --
The vendor guidance state for the component version. This state indicates whether the component version has any issues that you should consider before you deploy it. The vendor guidance state can be:
ACTIVE
– This component version is available and recommended for use.DISCONTINUED
– This component version has been discontinued by its publisher. You can deploy this component version, but we recommend that you use a different version of this component.DELETED
– This component version has been deleted by its publisher, so you can't deploy it. If you have any existing deployments that specify this component version, those deployments will fail.vendorGuidanceMessage (string) --
A message that communicates details about the vendor guidance state of the component version. This message communicates why a component version is discontinued or deleted.
Exceptions
GreengrassV2.Client.exceptions.ValidationException
GreengrassV2.Client.exceptions.ServiceQuotaExceededException
GreengrassV2.Client.exceptions.AccessDeniedException
GreengrassV2.Client.exceptions.ConflictException
GreengrassV2.Client.exceptions.ThrottlingException
GreengrassV2.Client.exceptions.InternalServerException
GreengrassV2.Client.exceptions.RequestAlreadyInProgressException