Deploying greengrass v2 public components using CDK (e.g. ShadowManager)?

0

Hi, I am working on a greengrass V2 project that uses CDK to automate the deployment. Everything is working up to now. However, I would like to use the public shadow manager greengrass v2 component in the deployment. From the console, I can manually add the aws.greengrass.ShadowManager to the deployment. However, I would like to add this component programmatically using CDK.

I copied the component recipe for the shadow manager and it shows that the URI is for example. I used this Uri in my CDK typescript template.

"Uri": "greengrass:n6*7r*yO*c9*QK*kN*77**G-G*H*bb*08*V*X50_k=/aws.greengrass.ShadowManager.jar"

but when I generate and deploy it using CDK I get an error:

Invalid Input: Encountered following errors in Artifacts: {greengrass:greengrass:n6*7r*yO*c9*QK*kN*77**G-G*H*bb*08*V*X50_k=/aws.greengrass.ShadowManager.jar = URI format does not meet the S3 URI requirements}

Do I need to copy the ShadowManager.jar to my S3 bucket and if so where can I download the ShadowManager.jar file from? I cant seem find any information on how I can deploy a public component such as the aws.greengrass.ShadowManager using CDK.

I have been following this guide but this doesnt show how to deploy public components using CDK: https://github.com/aws-samples/aws-iot-greengrass-v2-using-aws-cdk

Is there a good guide on deploying greengrass v2 public components using CDK? Could anyone be able to provide some guidance?

Many thanks Oide

asked 8 months ago219 views
5 Answers
0

Thanks Kwonyul. Your repo is very helpful. I got it working to create a local shadow manager. I really appreciate your quick response!!

To get my IoT code syncing local shadows to IoT core, I needed to set permissions for the policy that greengrass v2 uses connect so that the shadow manager so that it can communicate with the IOT core.

I needed to add some extra permissions to GreengrassV2IoTThingPolicy. I did this manually in the console via Thing->Certificate->Policies->GreengrassV2IoTThingPolicy

    {
      "Effect": "Allow",
      "Action": [
        "iot:GetThingShadow",
        "iot:UpdateThingShadow",
        "iot:DeleteThingShadow"
      ],
      "Resource": "*"
    }

Is there any way to add these permission using CDK?

Also, lastly :), are there any updates on using wildcards for Named Shadow in Shadow Manager syncing as per this post? My particular use case needs this as I would like a physical IoT device to create multiple local named shadows "on the fly" that can be managed in IoT core. Having to update the "Configuration merge" on the shadow manager component each time is a big limitation.

Many thanks for all your help! Oide

answered 8 months ago
0

Hi Oide,

To deploy a public component you do not need to create your own copy of it, which is what you're doing. Simply add the public component name and version into the deployment request. https://docs.aws.amazon.com/greengrass/v2/developerguide/create-deployments.html

answered 8 months ago
0

Thanks for reaching to me. I will add a new feature in “https://github.com/aws-samples/aws-iot-greengrass-v2-using-aws-cdk” by this weekend, where public component deployment will be covered. We don't need to upload the asset for public components, all we need to do is set the configuration information. But in fact, it is not easy to set where and how. So I'll implement that sample case and pass it on that repository on soon.

answered 8 months ago
0

Hi Oide,

I have added a usecase of public components deployment you requested to my repo(https://github.com/aws-samples/aws-iot-greengrass-v2-using-aws-cdk). You can find that in https://github.com/aws-samples/aws-iot-greengrass-v2-using-aws-cdk/blob/main/infra/stack/greengrass/component-deployment-stack.ts - "createPublicComponents()". Enjoy that~.

answered 8 months ago
0

Thanks Kwonyul. Your repo is very helpful.

answered 8 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions