awslabs / aws-greengrass-group-setup

File-driven creation of an entire AWS Greengrass group
Apache License 2.0
54 stars 23 forks source link

Auto activate "Automatically detect and override connection information" in a Group #7

Open brettf opened 7 years ago

brettf commented 7 years ago

The default behavior of an instantiated group should support auto-discovery of the Greengrass Core. A command like this works:

aws greengrass create-function-definition-version \
--function-definition-id 4d941bc7-92a1-4f45-8d64-EXAMPLEf76c3 \
--functions '[{"FunctionArn":"arn:aws:lambda:::function:GGIPDetector:1","Id":"1","FunctionConfiguration":{"Pinned":true,"MemorySize":32768,"Timeout":3}}]' \
--region us-west-2

Essentially, use create-function-defintion-version and add arn:aws:lambda:::function:GGIPDetector:1 just like any other Lambda with the function configuration as shown above.

ShaunEdiger commented 6 years ago

Until this bug is fixed, is the command above the recommended workaround?

brettf commented 6 years ago

@ShaunEdiger -- yes.

janborch commented 6 years ago

You can also create the definition and version in one go:

aws greengrass create-function-definition --cli-input-json '{
     "Name": "'"MyGroup_Function_Definition"'",
      "InitialVersion": {
     "Functions": [
    {
      "FunctionArn": "arn:aws:lambda:::function:GGIPDetector:1",
      "FunctionConfiguration": {
        "Environment": {},
        "MemorySize": 32768,
        "Pinned": true,
        "Timeout": 3
      },
      "Id": "'"$(uuidgen)"'""
    }]
    }

}'
manu51188 commented 6 years ago

You can also create the definition and version in one go:

aws greengrass create-function-definition --cli-input-json '{
     "Name": "'"MyGroup_Function_Definition"'",
      "InitialVersion": {
     "Functions": [
    {
      "FunctionArn": "arn:aws:lambda:::function:GGIPDetector:1",
      "FunctionConfiguration": {
        "Environment": {},
        "MemorySize": 32768,
        "Pinned": true,
        "Timeout": 3
      },
      "Id": "'"$(uuidgen)"'""
    }]
    }

}'

I am this function to create lambda function for automatic IP detector in AWS Greengrass group. I need you small help in understanding what exactly is variable "$(uuidgen)" is pointing to ? can I simply reaplce this variable with Group id ?

Something like this : "Id": "'"5c128568-b756-49cf-9e33-0b7e845852bd"'""

Can you please let me know.

manu51188 commented 6 years ago

I am using following command to create greengrass function

aws greengrass create-function-definition --cli-input-json '{

 "Name": "'"MyGroup_Function_Definition"'",
  "InitialVersion": {
 "Functions": [
{
  "FunctionArn": "arn:aws:lambda:::function:GGIPDetector:1",
  "FunctionConfiguration": {
    "Environment": {},
    "MemorySize": 32768,
    "Pinned": true,
    "Timeout": 3
  },
  "Id": "'"4"'"
}]
}

}'

Also, the function "arn:aws:lambda:::function:GGIPDetector:1" is already created in lambda just like normal function.

But I couldn't able to see the above function added in my GreenGrass Group. What can be the problem ?