EntityRecognizer class

Resource for managing an AWS Comprehend Entity Recognizer.

Example Usage

Basic Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const documents = new aws.s3.BucketObjectv2("documents", {});
const entities = new aws.s3.BucketObjectv2("entities", {});
const example = new aws.comprehend.EntityRecognizer("example", {
    inputDataConfig: {
        documents: {
            s3Uri: pulumi.interpolate`s3://${documentsAwsS3Bucket.bucket}/${documents.key}`,
        },
        entityList: {
            s3Uri: pulumi.interpolate`s3://${entitiesAwsS3Bucket.bucket}/${entities.key}`,
        },
        entityTypes: [
            {
                type: "ENTITY_1",
            },
            {
                type: "ENTITY_2",
            },
        ],
    },
    name: "example",
    dataAccessRoleArn: exampleAwsIamRole.arn,
    languageCode: "en",
}, {
    dependsOn: [exampleAwsIamRolePolicy],
});
import pulumi
import pulumi_aws as aws

documents = aws.s3.BucketObjectv2("documents")
entities = aws.s3.BucketObjectv2("entities")
example = aws.comprehend.EntityRecognizer("example",
    input_data_config={
        "documents": {
            "s3_uri": documents.key.apply(lambda key: f"s3://{documents_aws_s3_bucket['bucket']}/{key}"),
        },
        "entity_list": {
            "s3_uri": entities.key.apply(lambda key: f"s3://{entities_aws_s3_bucket['bucket']}/{key}"),
        },
        "entity_types": [
            {
                "type": "ENTITY_1",
            },
            {
                "type": "ENTITY_2",
            },
        ],
    },
    name="example",
    data_access_role_arn=example_aws_iam_role["arn"],
    language_code="en",
    opts = pulumi.ResourceOptions(depends_on=[example_aws_iam_role_policy]))
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var documents = new Aws.S3.BucketObjectv2("documents");

    var entities = new Aws.S3.BucketObjectv2("entities");

    var example = new Aws.Comprehend.EntityRecognizer("example", new()
    {
        InputDataConfig = new Aws.Comprehend.Inputs.EntityRecognizerInputDataConfigArgs
        {
            Documents = new Aws.Comprehend.Inputs.EntityRecognizerInputDataConfigDocumentsArgs
            {
                S3Uri = documents.Key.Apply(key => $"s3://{documentsAwsS3Bucket.Bucket}/{key}"),
            },
            EntityList = new Aws.Comprehend.Inputs.EntityRecognizerInputDataConfigEntityListArgs
            {
                S3Uri = entities.Key.Apply(key => $"s3://{entitiesAwsS3Bucket.Bucket}/{key}"),
            },
            EntityTypes = new[]
            {
                new Aws.Comprehend.Inputs.EntityRecognizerInputDataConfigEntityTypeArgs
                {
                    Type = "ENTITY_1",
                },
                new Aws.Comprehend.Inputs.EntityRecognizerInputDataConfigEntityTypeArgs
                {
                    Type = "ENTITY_2",
                },
            },
        },
        Name = "example",
        DataAccessRoleArn = exampleAwsIamRole.Arn,
        LanguageCode = "en",
    }, new CustomResourceOptions
    {
        DependsOn =
        {
            exampleAwsIamRolePolicy,
        },
    });

});
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/comprehend"
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/s3"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		documents, err := s3.NewBucketObjectv2(ctx, "documents", nil)
		if err != nil {
			return err
		}
		entities, err := s3.NewBucketObjectv2(ctx, "entities", nil)
		if err != nil {
			return err
		}
		_, err = comprehend.NewEntityRecognizer(ctx, "example", &comprehend.EntityRecognizerArgs{
			InputDataConfig: &comprehend.EntityRecognizerInputDataConfigArgs{
				Documents: &comprehend.EntityRecognizerInputDataConfigDocumentsArgs{
					S3Uri: documents.Key.ApplyT(func(key string) (string, error) {
						return fmt.Sprintf("s3://%v/%v", documentsAwsS3Bucket.Bucket, key), nil
					}).(pulumi.StringOutput),
				},
				EntityList: &comprehend.EntityRecognizerInputDataConfigEntityListArgs{
					S3Uri: entities.Key.ApplyT(func(key string) (string, error) {
						return fmt.Sprintf("s3://%v/%v", entitiesAwsS3Bucket.Bucket, key), nil
					}).(pulumi.StringOutput),
				},
				EntityTypes: comprehend.EntityRecognizerInputDataConfigEntityTypeArray{
					&comprehend.EntityRecognizerInputDataConfigEntityTypeArgs{
						Type: pulumi.String("ENTITY_1"),
					},
					&comprehend.EntityRecognizerInputDataConfigEntityTypeArgs{
						Type: pulumi.String("ENTITY_2"),
					},
				},
			},
			Name:              pulumi.String("example"),
			DataAccessRoleArn: pulumi.Any(exampleAwsIamRole.Arn),
			LanguageCode:      pulumi.String("en"),
		}, pulumi.DependsOn([]pulumi.Resource{
			exampleAwsIamRolePolicy,
		}))
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_comprehend_entityrecognizer" "example" {
  depends_on = [exampleAwsIamRolePolicy]
  input_data_config = {
    documents = {
      s3_uri ="s3://${documentsAwsS3Bucket.bucket}/${aws_s3_bucketobjectv2.documents.key}"
    }
    entity_list = {
      s3_uri ="s3://${entitiesAwsS3Bucket.bucket}/${aws_s3_bucketobjectv2.entities.key}"
    }
    entity_types = [{
      "type" = "ENTITY_1"
      }, {
      "type" = "ENTITY_2"
    }]
  }
  name                 = "example"
  data_access_role_arn = exampleAwsIamRole.arn
  language_code        = "en"
}
resource "aws_s3_bucketobjectv2" "documents" {
}
resource "aws_s3_bucketobjectv2" "entities" {
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.s3.BucketObjectv2;
import com.pulumi.aws.comprehend.EntityRecognizer;
import com.pulumi.aws.comprehend.EntityRecognizerArgs;
import com.pulumi.aws.comprehend.inputs.EntityRecognizerInputDataConfigArgs;
import com.pulumi.aws.comprehend.inputs.EntityRecognizerInputDataConfigDocumentsArgs;
import com.pulumi.aws.comprehend.inputs.EntityRecognizerInputDataConfigEntityListArgs;
import com.pulumi.aws.comprehend.inputs.EntityRecognizerInputDataConfigEntityTypeArgs;
import com.pulumi.resources.CustomResourceOptions;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var documents = new BucketObjectv2("documents");

        var entities = new BucketObjectv2("entities");

        var example = new EntityRecognizer("example", EntityRecognizerArgs.builder()
            .inputDataConfig(EntityRecognizerInputDataConfigArgs.builder()
                .documents(EntityRecognizerInputDataConfigDocumentsArgs.builder()
                    .s3Uri(documents.key().applyValue(_key -> String.format("s3://%s/%s", documentsAwsS3Bucket.bucket(),_key)))
                    .build())
                .entityList(EntityRecognizerInputDataConfigEntityListArgs.builder()
                    .s3Uri(entities.key().applyValue(_key -> String.format("s3://%s/%s", entitiesAwsS3Bucket.bucket(),_key)))
                    .build())
                .entityTypes(
                    EntityRecognizerInputDataConfigEntityTypeArgs.builder()
                        .type("ENTITY_1")
                        .build(),
                    EntityRecognizerInputDataConfigEntityTypeArgs.builder()
                        .type("ENTITY_2")
                        .build())
                .build())
            .name("example")
            .dataAccessRoleArn(exampleAwsIamRole.arn())
            .languageCode("en")
            .build(), CustomResourceOptions.builder()
                .dependsOn(exampleAwsIamRolePolicy)
                .build());

    }
}
resources:
  example:
    type: aws:comprehend:EntityRecognizer
    properties:
      inputDataConfig:
        documents:
          s3Uri: s3://${documentsAwsS3Bucket.bucket}/${documents.key}
        entityList:
          s3Uri: s3://${entitiesAwsS3Bucket.bucket}/${entities.key}
        entityTypes:
          - type: ENTITY_1
          - type: ENTITY_2
      name: example
      dataAccessRoleArn: ${exampleAwsIamRole.arn}
      languageCode: en
    options:
      dependsOn:
        - ${exampleAwsIamRolePolicy}
  documents:
    type: aws:s3:BucketObjectv2
  entities:
    type: aws:s3:BucketObjectv2

Import

Identity Schema

Required

  • arn (String) ARN of the Comprehend entity recognizer.

Using pulumi import, import Comprehend Entity Recognizer using the ARN. For example:

$ pulumi import aws:comprehend/entityRecognizer:EntityRecognizer example arn:aws:comprehend:us-west-2:123456789012:entity-recognizer/example

Constructors

EntityRecognizer(String name, {EntityRecognizerArgs? args, CustomResourceOptions? options})
Creates a new EntityRecognizer. name The Pulumi resource name. args Arguments used to configure this EntityRecognizer. The set of arguments for EntityRecognizer. options Resource options controlling this resource's behavior.
EntityRecognizer.reference(String urn)
Creates a typed reference to an existing EntityRecognizer resource.

Properties

arn ↔ Output<String>
ARN of the Entity Recognizer version.
latefinal
childResources Set<Resource>
finalinherited
completionSources Map<String, IOutputCompletionSource>
latefinalinherited
dataAccessRoleArn ↔ Output<String>
The ARN for an IAM Role which allows Comprehend to read the training and testing data.
latefinal
hashCode int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
inputDataConfig ↔ Output<EntityRecognizerInputDataConfig>
Configuration for the training and testing data. See the inputDataConfig Configuration Block section below.
latefinal
isCustom bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference bool
Whether this instance represents a resource value returned over RPC.
finalinherited
languageCode ↔ Output<String>
Two-letter language code for the language. One of en, es, fr, it, de, or pt.
latefinal
modelKmsKeyId ↔ Output<String?>
The ID or ARN of a KMS Key used to encrypt trained Entity Recognizers.
latefinal
name ↔ Output<String>
Name for the Entity Recognizer. Has a maximum length of 63 characters. Can contain upper- and lower-case letters, numbers, and hypen (-).
latefinal
region ↔ Output<String>
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
resourceTransforms List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
tags ↔ Output<Map<String, String>?>
A map of tags to assign to the resource. If configured with a provider defaultTags Configuration Block present, tags with matching keys will overwrite those defined at the provider-level.
latefinal
tagsAll ↔ Output<Map<String, String>>
A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.
latefinal
transformations List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
urn ↔ Output<String>
latefinalinherited
versionName ↔ Output<String>
Name for the version of the Entity Recognizer. Each version must have a unique name within the Entity Recognizer. If omitted, the provider will assign a random, unique version name. If explicitly set to "", no version name will be set. Has a maximum length of 63 characters. Can contain upper- and lower-case letters, numbers, and hypen (-). Conflicts with versionNamePrefix.
latefinal
versionNamePrefix ↔ Output<String>
Creates a unique version name beginning with the specified prefix. Has a maximum length of 37 characters. Can contain upper- and lower-case letters, numbers, and hypen (-). Conflicts with versionName.
latefinal
volumeKmsKeyId ↔ Output<String?>
ID or ARN of a KMS Key used to encrypt storage volumes during job processing.
latefinal
vpcConfig ↔ Output<EntityRecognizerVpcConfig?>
Configuration parameters for VPC to contain Entity Recognizer resources. See the vpcConfig Configuration Block section below.
latefinal

Methods

failId(Object error) → void
Completes this resource ID with an error when registration fails.
inherited
failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() String
Returns this resource's logical name.
inherited
getResourceType() String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
resolveId(String? value, {required bool isKnown}) → void
Resolves the provider-assigned ID for this resource.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

get(String name, Input<String> id, {EntityRecognizerState? state, CustomResourceOptions? options}) EntityRecognizer
Gets an existing EntityRecognizer resource's state with the given name and id.