Med Acc
Med Acc

Reputation: 3

Configure datapipeline to receive parameter values from a Lambda

I have a Lambda function that activates a datapipeline:

client.activate_pipeline(
    pipelineId='df-0680373LNPNFF73UDDD',
    parameterValues=[{'id':'myVariable','stringValue':'ok'}])

How do I configure the datapipeline to receive the parameterValues at activation. I want to pass the parameter value 'ok' to a ShellCommandActivity via Script Argument for example.

Upvotes: 0

Views: 343

Answers (1)

Amith Kumar
Amith Kumar

Reputation: 4882

In AWS Datapipeline you create parameters/variables & define its usage at time of putting pipeline definition.
Then parameter values can be either provided at same time put-pipeline-defintion or can be overridden at time of pipeline-activation.

If parameter is declared as myVariable, it can be referred inside pipeline object as #{myVariable}

client.put_pipeline_definition(
        pipelineId='myPipeline',
        pipelineObjects=[
            {
                'id': 'CreateDirectory',
                "type" : "ShellCommandActivity",
                'name': 'CreateDirectory',
                'fields': [
                    {
                        'key': 'command',
                        'stringValue': 'mkdir #{myVariable}'
                    }
                ]
            }
        ],
        parameterObjects=[
            {
                'id': 'myVariable',
                'attributes': [
                    {
                        'key': 'description',
                        'stringValue': 'The directory to be created'
                    }
                ]
            }
        ],


client.activate_pipeline(
    pipelineId='df-0680373LNPNFF73UDDD',
    parameterValues=[{'id':'myVariable','stringValue':'ok'}])

Upvotes: 2

Related Questions