SageMaker / Client / create_feature_group

create_feature_group#

SageMaker.Client.create_feature_group(**kwargs)#

Create a new FeatureGroup. A FeatureGroup is a group of Features defined in the FeatureStore to describe a Record.

The FeatureGroup defines the schema and features contained in the FeatureGroup. A FeatureGroup definition is composed of a list of Features, a RecordIdentifierFeatureName, an EventTimeFeatureName and configurations for its OnlineStore and OfflineStore. Check Amazon Web Services service quotas to see the ``FeatureGroup``s quota for your Amazon Web Services account.

Warning

You must include at least one of OnlineStoreConfig and OfflineStoreConfig to create a FeatureGroup.

See also: AWS API Documentation

Request Syntax

response = client.create_feature_group(
    FeatureGroupName='string',
    RecordIdentifierFeatureName='string',
    EventTimeFeatureName='string',
    FeatureDefinitions=[
        {
            'FeatureName': 'string',
            'FeatureType': 'Integral'|'Fractional'|'String'
        },
    ],
    OnlineStoreConfig={
        'SecurityConfig': {
            'KmsKeyId': 'string'
        },
        'EnableOnlineStore': True|False
    },
    OfflineStoreConfig={
        'S3StorageConfig': {
            'S3Uri': 'string',
            'KmsKeyId': 'string',
            'ResolvedOutputS3Uri': 'string'
        },
        'DisableGlueTableCreation': True|False,
        'DataCatalogConfig': {
            'TableName': 'string',
            'Catalog': 'string',
            'Database': 'string'
        },
        'TableFormat': 'Glue'|'Iceberg'
    },
    RoleArn='string',
    Description='string',
    Tags=[
        {
            'Key': 'string',
            'Value': 'string'
        },
    ]
)
Parameters:
  • FeatureGroupName (string) –

    [REQUIRED]

    The name of the FeatureGroup. The name must be unique within an Amazon Web Services Region in an Amazon Web Services account. The name:

    • Must start and end with an alphanumeric character.

    • Can only contain alphanumeric character and hyphens. Spaces are not allowed.

  • RecordIdentifierFeatureName (string) –

    [REQUIRED]

    The name of the Feature whose value uniquely identifies a Record defined in the FeatureStore. Only the latest record per identifier value will be stored in the OnlineStore. RecordIdentifierFeatureName must be one of feature definitions’ names.

    You use the RecordIdentifierFeatureName to access data in a FeatureStore.

    This name:

    • Must start and end with an alphanumeric character.

    • Can only contains alphanumeric characters, hyphens, underscores. Spaces are not allowed.

  • EventTimeFeatureName (string) –

    [REQUIRED]

    The name of the feature that stores the EventTime of a Record in a FeatureGroup.

    An EventTime is a point in time when a new event occurs that corresponds to the creation or update of a Record in a FeatureGroup. All Records in the FeatureGroup must have a corresponding EventTime.

    An EventTime can be a String or Fractional.

    • Fractional: EventTime feature values must be a Unix timestamp in seconds.

    • String: EventTime feature values must be an ISO-8601 string in the format. The following formats are supported yyyy-MM-dd'T'HH:mm:ssZ and yyyy-MM-dd'T'HH:mm:ss.SSSZ where yyyy, MM, and dd represent the year, month, and day respectively and HH, mm, ss, and if applicable, SSS represent the hour, month, second and milliseconds respsectively. 'T' and Z are constants.

  • FeatureDefinitions (list) –

    [REQUIRED]

    A list of Feature names and types. Name and Type is compulsory per Feature.

    Valid feature FeatureType``s are ``Integral, Fractional and String.

    FeatureName``s cannot be any of the following: ``is_deleted, write_time, api_invocation_time

    You can create up to 2,500 FeatureDefinition``s per ``FeatureGroup.

    • (dict) –

      A list of features. You must include FeatureName and FeatureType. Valid feature FeatureType``s are ``Integral, Fractional and String.

      • FeatureName (string) –

        The name of a feature. The type must be a string. FeatureName cannot be any of the following: is_deleted, write_time, api_invocation_time.

      • FeatureType (string) –

        The value type of a feature. Valid values are Integral, Fractional, or String.

  • OnlineStoreConfig (dict) –

    You can turn the OnlineStore on or off by specifying True for the EnableOnlineStore flag in OnlineStoreConfig.

    You can also include an Amazon Web Services KMS key ID ( KMSKeyId) for at-rest encryption of the OnlineStore.

    The default value is False.

    • SecurityConfig (dict) –

      Use to specify KMS Key ID ( KMSKeyId) for at-rest encryption of your OnlineStore.

      • KmsKeyId (string) –

        The Amazon Web Services Key Management Service (KMS) key ARN that SageMaker Feature Store uses to encrypt the Amazon S3 objects at rest using Amazon S3 server-side encryption.

        The caller (either user or IAM role) of CreateFeatureGroup must have below permissions to the OnlineStore KmsKeyId:

        • "kms:Encrypt"

        • "kms:Decrypt"

        • "kms:DescribeKey"

        • "kms:CreateGrant"

        • "kms:RetireGrant"

        • "kms:ReEncryptFrom"

        • "kms:ReEncryptTo"

        • "kms:GenerateDataKey"

        • "kms:ListAliases"

        • "kms:ListGrants"

        • "kms:RevokeGrant"

        The caller (either user or IAM role) to all DataPlane operations ( PutRecord, GetRecord, DeleteRecord) must have the following permissions to the KmsKeyId:

        • "kms:Decrypt"

    • EnableOnlineStore (boolean) –

      Turn OnlineStore off by specifying False for the EnableOnlineStore flag. Turn OnlineStore on by specifying True for the EnableOnlineStore flag.

      The default value is False.

  • OfflineStoreConfig (dict) –

    Use this to configure an OfflineFeatureStore. This parameter allows you to specify:

    • The Amazon Simple Storage Service (Amazon S3) location of an OfflineStore.

    • A configuration for an Amazon Web Services Glue or Amazon Web Services Hive data catalog.

    • An KMS encryption key to encrypt the Amazon S3 location used for OfflineStore. If KMS encryption key is not specified, by default we encrypt all data at rest using Amazon Web Services KMS key. By defining your bucket-level key for SSE, you can reduce Amazon Web Services KMS requests costs by up to 99 percent.

    • Format for the offline store table. Supported formats are Glue (Default) and Apache Iceberg.

    To learn more about this parameter, see OfflineStoreConfig.

    • S3StorageConfig (dict) – [REQUIRED]

      The Amazon Simple Storage (Amazon S3) location of OfflineStore.

      • S3Uri (string) – [REQUIRED]

        The S3 URI, or location in Amazon S3, of OfflineStore.

        S3 URIs have a format similar to the following: s3://example-bucket/prefix/.

      • KmsKeyId (string) –

        The Amazon Web Services Key Management Service (KMS) key ARN of the key used to encrypt any objects written into the OfflineStore S3 location.

        The IAM roleARN that is passed as a parameter to CreateFeatureGroup must have below permissions to the KmsKeyId:

        • "kms:GenerateDataKey"

      • ResolvedOutputS3Uri (string) –

        The S3 path where offline records are written.

    • DisableGlueTableCreation (boolean) –

      Set to True to disable the automatic creation of an Amazon Web Services Glue table when configuring an OfflineStore. If set to False, Feature Store will name the OfflineStore Glue table following Athena’s naming recommendations.

      The default value is False.

    • DataCatalogConfig (dict) –

      The meta data of the Glue table that is autogenerated when an OfflineStore is created.

      • TableName (string) – [REQUIRED]

        The name of the Glue table.

      • Catalog (string) – [REQUIRED]

        The name of the Glue table catalog.

      • Database (string) – [REQUIRED]

        The name of the Glue table database.

    • TableFormat (string) –

      Format for the offline store table. Supported formats are Glue (Default) and Apache Iceberg.

  • RoleArn (string) – The Amazon Resource Name (ARN) of the IAM execution role used to persist data into the OfflineStore if an OfflineStoreConfig is provided.

  • Description (string) – A free-form description of a FeatureGroup.

  • Tags (list) –

    Tags used to identify Features in each FeatureGroup.

    • (dict) –

      A tag object that consists of a key and an optional value, used to manage metadata for SageMaker Amazon Web Services resources.

      You can add tags to notebook instances, training jobs, hyperparameter tuning jobs, batch transform jobs, models, labeling jobs, work teams, endpoint configurations, and endpoints. For more information on adding tags to SageMaker resources, see AddTags.

      For more information on adding metadata to your Amazon Web Services resources with tagging, see Tagging Amazon Web Services resources. For advice on best practices for managing Amazon Web Services resources with tagging, see Tagging Best Practices: Implement an Effective Amazon Web Services Resource Tagging Strategy.

      • Key (string) – [REQUIRED]

        The tag key. Tag keys must be unique per resource.

      • Value (string) – [REQUIRED]

        The tag value.

Return type:

dict

Returns:

Response Syntax

{
    'FeatureGroupArn': 'string'
}

Response Structure

  • (dict) –

    • FeatureGroupArn (string) –

      The Amazon Resource Name (ARN) of the FeatureGroup. This is a unique identifier for the feature group.

Exceptions

  • SageMaker.Client.exceptions.ResourceInUse

  • SageMaker.Client.exceptions.ResourceLimitExceeded