3 réponses
- Le plus récent
- Le plus de votes
- La plupart des commentaires
1
I couldn't find any update to the CDK spec on this or on adding things to thing groups. I had to go with custom resources, like below:
const myThingGroup = new cr.AwsCustomResource(this, 'my-thing-group', {
onCreate: {
service: 'Iot',
action: 'createThingGroup',
parameters: {
thingGroupName: 'my-tg-name'
},
physicalResourceId: cr.PhysicalResourceId.of(Date.now().toString()),
},
onDelete: {
service: 'Iot',
action: 'deleteThingGroup',
parameters: {
thingGroupName: 'my-tg-name'
},
},
policy: cr.AwsCustomResourcePolicy.fromSdkCalls({
resources: cr.AwsCustomResourcePolicy.ANY_RESOURCE,
}),
});
When I added and removed things to/from thing groups, I needed to use addDependency otherwise cdk destroy failed, like this:
myThingThingGroupDetachment.node.addDependency(myThing)
myThingThingGroupDetachment.node.addDependency(myThingGroup)
Hope this saves some time for someone.
répondu il y a un an
0
At this moment, we have to either create custom resources or use the APIs.
Contenus pertinents
- demandé il y a un an
- demandé il y a un mois
- demandé il y a un mois
- demandé il y a un an
- AWS OFFICIELA mis à jour il y a 2 ans
- AWS OFFICIELA mis à jour il y a 3 ans
- AWS OFFICIELA mis à jour il y a 2 ans
Can you have cloudformation trigger an API?
I jus want to create the User group on creation and delete it if the stack is deleted
You can try it via custom resource, please refer https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-custom-resources.html