ResourceDefinition
The ResourceDefinition resource allows you to manage AWS Greengrass ResourceDefinitions which define the resources that your Greengrass group can access.
Minimal Example
Section titled “Minimal Example”This example demonstrates how to create a basic ResourceDefinition with required properties and one optional property.
import AWS from "alchemy/aws/control";
const resourceDefinition = await AWS.Greengrass.ResourceDefinition("myResourceDefinition", { Name: "MyResourceDefinition", InitialVersion: { Resources: { MyS3Bucket: { Id: "MyS3Bucket", Type: "S3", ResourceDataContainer: { S3Data: { BucketARN: "arn:aws:s3:::my-bucket", ETag: "etag-value", Key: "my-data-file.txt" } } } } }, Tags: { Environment: "Development" }});
Advanced Configuration
Section titled “Advanced Configuration”In this example, we configure a ResourceDefinition with multiple resource types and additional tags.
const advancedResourceDefinition = await AWS.Greengrass.ResourceDefinition("advancedResourceDefinition", { Name: "AdvancedResourceDefinition", InitialVersion: { Resources: { MyDynamoDBTable: { Id: "MyDynamoDBTable", Type: "DynamoDB", ResourceDataContainer: { DynamoDB: { TableARN: "arn:aws:dynamodb:us-west-2:123456789012:table/MyTable", RoleARN: "arn:aws:iam::123456789012:role/MyGreengrassRole" } } }, MyS3Bucket: { Id: "MyS3Bucket", Type: "S3", ResourceDataContainer: { S3Data: { BucketARN: "arn:aws:s3:::my-bucket", ETag: "etag-value", Key: "my-data-file.txt" } } } } }, Tags: { Environment: "Production", Project: "IoTApp" }});
Resource with Adoption
Section titled “Resource with Adoption”This example shows how to create a ResourceDefinition with the adoption property set to true, allowing you to adopt an existing resource.
const adoptedResourceDefinition = await AWS.Greengrass.ResourceDefinition("adoptedResourceDefinition", { Name: "AdoptedResourceDefinition", InitialVersion: { Resources: { MyS3Bucket: { Id: "MyS3Bucket", Type: "S3", ResourceDataContainer: { S3Data: { BucketARN: "arn:aws:s3:::existing-bucket", ETag: "etag-value", Key: "existing-data-file.txt" } } } } }, adopt: true});