def deploy_components()

in codes/lambda/custom_gg_comp_deploy/src/handler.py [0:0]


def deploy_components(props):
    target_arn = str(props['TARGET_ARN'])
    deployment_name = str(props['DEPLOYMENT_NAME'])
    components = str(props['COMPONENTS'])
    print('Deploy Components===>', components)

    try:
        client = boto3.client('greengrassv2')
        response = client.create_deployment(
            targetArn=target_arn,
            deploymentName=deployment_name,
            components=json.loads(components)
        )
        print('deploy_components: success', response)
        return response['deploymentId']
    except Exception as e:
        print("deploy_components: fail", e)
        return None