Hello,
Is there a way to use CloudFormation to create new versions of a Greengrass component without deleting older ones?
My intent is to prove this out in CloudFormation, then migrate to CDK and make an L2 construct for our use.
I'm migrating from direct manipulation of Greengrass resources to CloudFormation. This includes creation and deployment of custom components. When I call update-stack to create a new Greengrass component version, it deletes any other existing versions. Is there a way to use CDK and retain older component versions? Preferably this would be without having to rename the component each time, or place a permissions override on the delete. I have tried adding the retain flag to the resource. Here is the template I'm using:
Parameters:
ComponentVersion:
Type: String
Resources:
MyComponentVersion:
Type: AWS::GreengrassV2::ComponentVersion
DeletionPolicy: Retain
Properties:
InlineRecipe: !Sub
- "{\n
\"RecipeFormatVersion\": \"2020-01-25\",\n
\"ComponentName\": \"com.me.cftestapp\",\n
\"ComponentVersion\": \"${ComponentVersion}\",\n
\"ComponentType\": \"aws.greengrass.generic\",\n
\"ComponentDescription\": \"Test CF usage\",\n
\"ComponentPublisher\": \"me\",\n
\"ComponentConfiguration\": {\n
\"DefaultConfiguration\": {\n
\"accessControl\": {\n
\"aws.greengrass.ipc.mqttproxy\": {\n
\"com.example.MyIoTCorePubSubComponent:mqttproxy:1\": {\n
\"policyDescription\": \"Allows access to publish/subscribe to all topics.\",\n
\"operations\": [\n
\"aws.greengrass#PublishToIoTCore\",\n
\"aws.greengrass#SubscribeToIoTCore\"\n
],\n
\"resources\": [\n
\"*\"\n
]\n
}\n
},\n
\"aws.greengrass.ipc.pubsub\": {\n
\"com.example.MyLocalPubSubComponent:pubsub:1\": {\n
\"policyDescription\": \"Allows access to publish/subscribe to all topics.\",\n
\"operations\": [\n
\"aws.greengrass#PublishToTopic\",\n
\"aws.greengrass#SubscribeToTopic\"\n
],\n
\"resources\": [\n
\"*\"\n
]\n
}\n
}\n
}\n
}\n
},\n
\"Manifests\": [\n
{\n
\"Platform\": {\n
\"os\": \"linux\",\n
\"architecture\": \"amd64\"\n
},\n
\"Name\": \"cf-test-amd64-linux\",\n
\"Lifecycle\": {\n
\"run\": \"{artifacts:path}/hello-world.sh\"\n
},\n
\"Artifacts\": [\n
{\n
\"Uri\": \"s3://mys3/hello-world.sh\",\n
\"Digest\": \"clBq/9HjX5aGmU3+wJY/pRlM+DCDOKaXRTSR1svdqMA=\",\n
\"Algorithm\": \"SHA-256\",\n
\"Unarchive\": \"NONE\",\n
\"Permission\": {\n
\"Read\": \"OWNER\",\n
\"Execute\": \"ALL\"\n
}\n
}\n
]\n
}\n
],\n
\"Lifecycle\": {\n
}\n
}"
- { ComponentVersion: !Ref ComponentVersion }
That worked great! Thank you!