SageMaker / Client / create_feature_group
create_feature_group#
- SageMaker.Client.create_feature_group(**kwargs)#
Create a new
FeatureGroup. AFeatureGroupis a group ofFeaturesdefined in theFeatureStoreto describe aRecord.The
FeatureGroupdefines the schema and features contained in theFeatureGroup. AFeatureGroupdefinition is composed of a list ofFeatures, aRecordIdentifierFeatureName, anEventTimeFeatureNameand configurations for itsOnlineStoreandOfflineStore. Check Amazon Web Services service quotas to see the ``FeatureGroup``s quota for your Amazon Web Services account.Note that it can take approximately 10-15 minutes to provision an
OnlineStoreFeatureGroupwith theInMemoryStorageType.Warning
You must include at least one of
OnlineStoreConfigandOfflineStoreConfigto create aFeatureGroup.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', 'CollectionType': 'List'|'Set'|'Vector', 'CollectionConfig': { 'VectorConfig': { 'Dimension': 123 } } }, ], OnlineStoreConfig={ 'SecurityConfig': { 'KmsKeyId': 'string' }, 'EnableOnlineStore': True|False, 'TtlDuration': { 'Unit': 'Seconds'|'Minutes'|'Hours'|'Days'|'Weeks', 'Value': 123 }, 'StorageType': 'Standard'|'InMemory' }, OfflineStoreConfig={ 'S3StorageConfig': { 'S3Uri': 'string', 'KmsKeyId': 'string', 'ResolvedOutputS3Uri': 'string' }, 'DisableGlueTableCreation': True|False, 'DataCatalogConfig': { 'TableName': 'string', 'Catalog': 'string', 'Database': 'string' }, 'TableFormat': 'Default'|'Glue'|'Iceberg' }, ThroughputConfig={ 'ThroughputMode': 'OnDemand'|'Provisioned', 'ProvisionedReadCapacityUnits': 123, 'ProvisionedWriteCapacityUnits': 123 }, 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 with an alphanumeric character.
Can only include alphanumeric characters, underscores, and hyphens. Spaces are not allowed.
RecordIdentifierFeatureName (string) –
[REQUIRED]
The name of the
Featurewhose value uniquely identifies aRecorddefined in theFeatureStore. Only the latest record per identifier value will be stored in theOnlineStore.RecordIdentifierFeatureNamemust be one of feature definitions’ names.You use the
RecordIdentifierFeatureNameto access data in aFeatureStore.This name:
Must start 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
EventTimeof aRecordin aFeatureGroup.An
EventTimeis a point in time when a new event occurs that corresponds to the creation or update of aRecordin aFeatureGroup. AllRecordsin theFeatureGroupmust have a correspondingEventTime.An
EventTimecan be aStringorFractional.Fractional:EventTimefeature values must be a Unix timestamp in seconds.String:EventTimefeature values must be an ISO-8601 string in the format. The following formats are supportedyyyy-MM-dd'T'HH:mm:ssZandyyyy-MM-dd'T'HH:mm:ss.SSSZwhereyyyy,MM, andddrepresent the year, month, and day respectively andHH,mm,ss, and if applicable,SSSrepresent the hour, month, second and milliseconds respsectively.'T'andZare constants.
FeatureDefinitions (list) –
[REQUIRED]
A list of
Featurenames and types.NameandTypeis compulsory perFeature.Valid feature
FeatureType``s are ``Integral,FractionalandString.FeatureName``s cannot be any of the following: ``is_deleted,write_time,api_invocation_timeYou can create up to 2,500
FeatureDefinition``s per ``FeatureGroup.(dict) –
A list of features. You must include
FeatureNameandFeatureType. Valid featureFeatureType``s are ``Integral,FractionalandString.FeatureName (string) – [REQUIRED]
The name of a feature. The type must be a string.
FeatureNamecannot be any of the following:is_deleted,write_time,api_invocation_time.The name:
Must start with an alphanumeric character.
Can only include alphanumeric characters, underscores, and hyphens. Spaces are not allowed.
FeatureType (string) – [REQUIRED]
The value type of a feature. Valid values are Integral, Fractional, or String.
CollectionType (string) –
A grouping of elements where each element within the collection must have the same feature type (
String,Integral, orFractional).List: An ordered collection of elements.Set: An unordered collection of unique elements.Vector: A specialized list that represents a fixed-size array of elements. The vector dimension is determined by you. Must have elements with fractional feature types.
CollectionConfig (dict) –
Configuration for your collection.
Note
This is a Tagged Union structure. Only one of the following top level keys can be set:
VectorConfig.VectorConfig (dict) –
Configuration for your vector collection type.
Dimension: The number of elements in your vector.
Dimension (integer) – [REQUIRED]
The number of elements in your vector.
OnlineStoreConfig (dict) –
You can turn the
OnlineStoreon or off by specifyingTruefor theEnableOnlineStoreflag inOnlineStoreConfig.You can also include an Amazon Web Services KMS key ID (
KMSKeyId) for at-rest encryption of theOnlineStore.The default value is
False.SecurityConfig (dict) –
Use to specify KMS Key ID (
KMSKeyId) for at-rest encryption of yourOnlineStore.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
CreateFeatureGroupmust have below permissions to theOnlineStoreKmsKeyId:"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 theKmsKeyId:"kms:Decrypt"
EnableOnlineStore (boolean) –
Turn
OnlineStoreoff by specifyingFalsefor theEnableOnlineStoreflag. TurnOnlineStoreon by specifyingTruefor theEnableOnlineStoreflag.The default value is
False.TtlDuration (dict) –
Time to live duration, where the record is hard deleted after the expiration time is reached;
ExpiresAt=EventTime+TtlDuration. For information on HardDelete, see the DeleteRecord API in the Amazon SageMaker API Reference guide.Unit (string) –
TtlDurationtime unit.Value (integer) –
TtlDurationtime value.
StorageType (string) –
Option for different tiers of low latency storage for real-time data retrieval.
Standard: A managed low latency data store for feature groups.InMemory: A managed data store for feature groups that supports very low latency retrieval.
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
OfflineStoreS3 location.The IAM
roleARNthat is passed as a parameter toCreateFeatureGroupmust have below permissions to theKmsKeyId:"kms:GenerateDataKey"
ResolvedOutputS3Uri (string) –
The S3 path where offline records are written.
DisableGlueTableCreation (boolean) –
Set to
Trueto disable the automatic creation of an Amazon Web Services Glue table when configuring anOfflineStore. If set toFalse, Feature Store will name theOfflineStoreGlue 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
OfflineStoreis 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.
ThroughputConfig (dict) –
Used to set feature group throughput configuration. There are two modes:
ON_DEMANDandPROVISIONED. With on-demand mode, you are charged for data reads and writes that your application performs on your feature group. You do not need to specify read and write throughput because Feature Store accommodates your workloads as they ramp up and down. You can switch a feature group to on-demand only once in a 24 hour period. With provisioned throughput mode, you specify the read and write capacity per second that you expect your application to require, and you are billed based on those limits. Exceeding provisioned throughput will result in your requests being throttled.Note:
PROVISIONEDthroughput mode is supported only for feature groups that are offline-only, or use the Standard tier online store.ThroughputMode (string) – [REQUIRED]
The mode used for your feature group throughput:
ON_DEMANDorPROVISIONED.ProvisionedReadCapacityUnits (integer) –
For provisioned feature groups with online store enabled, this indicates the read throughput you are billed for and can consume without throttling.
This field is not applicable for on-demand feature groups.
ProvisionedWriteCapacityUnits (integer) –
For provisioned feature groups, this indicates the write throughput you are billed for and can consume without throttling.
This field is not applicable for on-demand feature groups.
RoleArn (string) – The Amazon Resource Name (ARN) of the IAM execution role used to persist data into the
OfflineStoreif anOfflineStoreConfigis provided.Description (string) – A free-form description of a
FeatureGroup.Tags (list) –
Tags used to identify
Featuresin eachFeatureGroup.(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.ResourceInUseSageMaker.Client.exceptions.ResourceLimitExceeded