Zero Labs
Industry News / AI

Complete One-Stop Guideline: Feature Store Theory and Feast Configuration on AWS

Source · Towards AI By Faizulkhan

From the publisher’s feed, collected in the ZeroLabs newsroom.

1. IntroductionModern machine learning systems do not fail only because of bad models. In many real-world cases, they fail because the features used during model training are not produced in the same way during model serving. This creates inconsistency between training and inference, resulting in unreliable model behavior.A Feature Store solves this problem by becoming the central system for defining, managing, storing, and serving machine learning features.In this implementation, the feature store is built using Feast, deployed on AWS, with infrastructure created using Pulumi, Redis used as the online store, and a Parquet file used as the offline source.2. Theoretical Foundation2.1 What is a feature?A feature is an input variable used by a machine learning model.Examples:customer ageaverage transaction amountnumber of failed logins in the last 24 hoursproduct click-through rateuser subscription tierA model does not consume raw business systems directly. It consumes transformed data called features.2.2 What is a Feature Store?A Feature Store is a system that centralizes the lifecycle of features for machine learning.It usually provides:feature definition and reusemetadata managementoffline access for trainingonline access for inferenceconsistency between training and servingfeature discovery and governanceIn simple language:A Feature Store is the bridge between raw data engineering and reliable model inference.2.3 Why do we need a Feature Store?Without a Feature Store:data scientists create features for training in notebooks or batch jobssoftware engineers recreate the same logic separately for inferenceboth implementations drift apartthe model sees different feature values in production than during trainingThis causes training-serving skew.With a Feature Store:feature definitions are centralizedfeatures can be reusedthe same feature contract is applied in training and servingonline and offline access are managed in a structured way2.4 Training-serving skewThis is one of the most important theoretical reasons Feature Stores exist.Training-serving skew happens when:the feature used during model training is calculated one waybut in production inference it is calculated differentlyExample:During training:average transaction amount is computed over the last 30 daysDuring inference:a developer mistakenly computes over the last 7 daysNow the model receives a feature distribution different from what it learned. Even if the model is technically correct, predictions become inconsistent.A Feature Store reduces this problem by standardizing feature definitions and their serving paths.2.5 Online store vs offline storeA Feature Store usually separates feature access into two worlds.Offline storeUsed for:historical feature databatch accessmodel traininglarge-volume analyticsOnline storeUsed for:low-latency feature lookupreal-time inferenceserving features to applications or APIsIn our lab:offline source = local file / Parquetonline store = RedisThat means:Parquet represents historical/training-oriented feature dataRedis represents fast-serving storage for online access2.6 Metadata and registryA Feature Store also needs a central metadata layer that knows:what entities existwhat feature views existwhere data comes fromwhat schemas are definedhow features are stored and retrievedIn Feast, this metadata is tracked through the registry.In our lab:registry file = data/registry.db2.7 Why Feast?Feast is an open-source Feature Store focused on bridging:data engineeringML workflowsonline servingoffline retrievalFeast is popular because it gives a structured way to define:entitiesfeature viewsdata sourcesonline and offline storesIt is lightweight enough for labs and learning, but also conceptually close to real MLOps production patterns.3. Why Feast is used in this labFeast is used because it gives a practical, teachable implementation of Feature Store ideas.It helps demonstrate:what an entity ishow features are definedhow online and offline storage are separatedhow a feature server can expose features through an APIhow to avoid ad hoc feature managementThis makes it ideal for a learning lab.4. Architecture of this labThe original lab architecture uses:a Bastion Hosta Feast ServerVPC, subnets, route tables, and NATRedisFeast Server on port 6566Our final working implementation simplified access by moving the Feast instance into a public subnet so installation could proceed without NAT issues.Final practical working architectureLab VM / local terminal | vAWS EC2 Bastion Host (public subnet) | vAWS EC2 Feast Server (public subnet in final working path) | +-- Redis (online store) +-- Parquet file (offline source) +-- Feast registry +-- Feast Feature Server (port 6566)Conceptually, the lab still teaches the original secure pattern:bastion for controlled accessFeast server for feature managementonline/offline feature separation5. End-to-end implementation flowThe implementation can be understood in two major phases.Phase A: InfrastructureCreate cloud resources with Pulumi:VPCsubnetsinternet gatewayNAT gatewayroute tablesbastion EC2Feast EC2security groupsPhase B: Feature Store setupAfter the infrastructure is ready:install Redisinstall Condacreate Feast Python environmentinstall Feastcreate Feast repo configdefine entities and feature viewscreate sample parquet datarun feast applystart Feast server6. Final project structureHere is the logical project structure for the Feast configuration part:feast-lab/├── .gitignore├── README.md├── docs/│ ├── architecture.md│ ├── setup-guide.md│ └── troubleshooting.md├── feast_app/│ ├── feature_store.yaml│ ├── start_feast.py│ ├── test_data.parquet│ ├── test_features.py│ ├── data/│ │ └── registry.db│ └── notebooks/│ └── README.md└── infra/ ├── main.py ├── Pulumi.yaml ├── Pulumi.dev.yaml ├── requirements.txt ├── venv/ ← empty folder (no files inside) └── scripts/ └── README.md7. Infrastructure file: main.pyThis is the final practical Pulumi file that made the lab workable by exposing the Feast server publicly.import pulumiimport pulumi_aws as awsvpc = aws.ec2.Vpc( "my-vpc", cidr_block="10.0.0.0/16", enable_dns_hostnames=True, enable_dns_support=True, tags={"Name": "my-vpc"},)public_subnet = aws.ec2.Subnet( "public-subnet", vpc_id=vpc.id, cidr_block="10.0.1.0/24", availability_zone="ap-southeast-1a", map_public_ip_on_launch=True, tags={"Name": "public-subnet"},)private_subnet = aws.ec2.Subnet( "private-subnet", vpc_id=vpc.id, cidr_block="10.0.2.0/24", availability_zone="ap-southeast-1a", tags={"Name": "private-subnet"},)igw = aws.ec2.InternetGateway( "internet-gateway", vpc_id=vpc.id, tags={"Name": "my-igw"},)public_rt = aws.ec2.RouteTable( "public-route-table", vpc_id=vpc.id, tags={"Name": "public-route-table"},)aws.ec2.Route( "public-route", route_table_id=public_rt.id, destination_cidr_block="0.0.0.0/0", gateway_id=igw.id,)aws.ec2.RouteTableAssociation( "public-rt-assoc", subnet_id=public_subnet.id, route_table_id=public_rt.id,)eip = aws.ec2.Eip( "nat-eip", domain="vpc", tags={"Name": "nat-eip"},)nat = aws.ec2.NatGateway( "nat-gateway", subnet_id=public_subnet.id, allocation_id=eip.id, tags={"Name": "nat-gateway"},)private_rt = aws.ec2.RouteTable( "private-route-table", vpc_id=vpc.id, tags={"Name": "private-route-table"},)aws.ec2.Route( "private-route", route_table_id=private_rt.id, destination_cidr_block="0.0.0.0/0", nat_gateway_id=nat.id,)aws.ec2.RouteTableAssociation( "private-rt-assoc", subnet_id=private_subnet.id, route_table_id=private_rt.id,)bastion_sg = aws.ec2.SecurityGroup( "bastion-sg", vpc_id=vpc.id, description="Allow SSH from anywhere", ingress=[ { "protocol": "tcp", "from_port": 22, "to_port": 22, "cidr_blocks": ["0.0.0.0/0"], } ], egress=[ { "protocol": "-1", "from_port": 0, "to_port": 0, "cidr_blocks": ["0.0.0.0/0"], } ], tags={"Name": "bastion-sg"},)feast_sg = aws.ec2.SecurityGroup( "feast-sg", vpc_id=vpc.id, description="Allow SSH and Feast access", ingress=[ { "protocol": "tcp", "from_port": 22, "to_port": 22, "cidr_blocks": ["0.0.0.0/0"], }, { "protocol": "tcp", "from_port": 6379, "to_port": 6379, "cidr_blocks": ["10.0.0.0/16"], }, { "protocol": "tcp", "from_port": 6566, "to_port": 6566, "cidr_blocks": ["10.0.0.0/16"], }, ], egress=[ { "protocol": "-1", "from_port": 0, "to_port": 0, "cidr_blocks": ["0.0.0.0/0"], } ], tags={"Name": "feast-sg"},)ubuntu_ami = aws.ec2.get_ami( most_recent=True, owners=["099720109477"], filters=[ { "name": "name", "values": ["ubuntu/images/hvm-ssd-gp3/ubuntu-noble-24.04-amd64-server-*"], }, { "name": "virtualization-type", "values": ["hvm"], }, ],)bastion = aws.ec2.Instance( "bastion-host", instance_type="t2.micro", ami=ubuntu_ami.id, subnet_id=public_subnet.id, vpc_security_group_ids=[bastion_sg.id], key_name="MyKeyPair", associate_public_ip_address=True, tags={"Name": "bastion-host"},)feast = aws.ec2.Instance( "feast-server", instance_type="t2.micro", ami=ubuntu_ami.id, subnet_id=public_subnet.id, vpc_security_group_ids=[feast_sg.id], key_name="MyKeyPair", associate_public_ip_address=True, root_block_device=aws.ec2.InstanceRootBlockDeviceArgs( volume_size=20, volume_type="gp3", ), tags={"Name": "feast-server"},)pulumi.export("vpc_id", vpc.id)pulumi.export("bastion_public_ip", bastion.public_ip)pulumi.export("bastion_private_ip", bastion.private_ip)pulumi.export("feast_public_ip", feast.public_ip)pulumi.export("feast_private_ip", feast.private_ip)pulumi.export( "ssh_bastion", pulumi.Output.concat("ssh -i MyKeyPair.pem ubuntu@", bastion.public_ip),)pulumi.export( "ssh_feast_public", pulumi.Output.concat("ssh -i MyKeyPair.pem ubuntu@", feast.public_ip),)pulumi.export( "feast_serving_url", pulumi.Output.concat("http://", feast.public_ip, ":6566"),)Why this file existsThis file defines all AWS infrastructure in code, which is the idea of Infrastructure as Code.What this file doescreates networkingcreates bastion and Feast EC2 instancescreates security groupsexports IPs and SSH commandsWhy this mattersIt makes infrastructure:reproducibleversion-controlledautomatable8. Feast configuration files8.1 feature_store.yamlFinal content:project: fraud_detection_featuresregistry: data/registry.dbprovider: localonline_store: type: redis connection_string: "localhost:6379"offline_store: type: fileentity_key_serialization_version: 3Explanationproject Defines the Feast project name.registry Stores Feast metadata. In this lab, it is a local SQLite-backed registry database file path under the data directory.provider: local Indicates a local-style provider configuration suitable for this lab.online_store Configures Redis, which is used to serve low-latency features during inference.offline_store Uses file-based storage for training or historical feature definitions.entity_key_serialization_version Defines serialization behavior for entity keys.Why this file is essentialThis is the core config file that tells Feast:which project is being managedwhere metadata is storedwhich online and offline stores to use8.2 test_features.pyFinal content:from feast import Entity, FeatureView, Field, FileSourcefrom feast.types import Float64from feast.value_type import ValueTypefrom datetime import timedeltatest_entity = Entity( name="test_id", join_keys=["id"], value_type=ValueType.INT64)test_source = FileSource( path="test_data.parquet", timestamp_field="timestamp")test_fv = FeatureView( name="test_features", entities=[test_entity], ttl=timedelta(days=1), schema=[ Field(name="value", dtype=Float64), ], source=test_source)ExplanationEntity Defines the join key that identifies the object for which features are retrieved. Here, test_id is the logical entity, and id is the physical join key in the dataset.value_type=ValueType.INT64 Defines the entity type in the way compatible with our Feast version.FileSource Defines the offline data source. Here it points to test_data.parquet.timestamp_field Required for time-aware feature retrieval and data validation.FeatureView Defines the set of features exposed from the source for a specific entity.ttl=timedelta(days=1) Sets the feature freshness window.schema Defines the columns exposed as features. Here, value is of type Float64.Why this file mattersThis is where the actual feature logic begins. Without this file, Feast has no entity or feature view to register.8.3 test_data.parquetThis file is generated, not hand-written. It is created with a small Python script:after pulling the code from git repo need to remove test_data.parquetfile and in runtime shell run the below then it creates again the file test_data.parquetpython - import pandas as pdfrom datetime import datetimedf = pd.DataFrame({ "id": [1, 2, 3], "value": [10.5, 20.7, 30.1], "timestamp": [ datetime.now(), datetime.now(), datetime.now() ]})df.to_parquet("test_data.parquet", index=False)print("Created test_data.parquet")EOFWhy it is neededFeast validates the source during feast apply. If the Parquet file does not exist, Feast cannot infer schema and fails.Why this happened in our labInitially, feast apply failed because test_data.parquet did not exist. Creating this file resolved the issue.8.4 start_feast.pyFinal content:#!/usr/bin/env python3import subprocessimport sysprint("Starting Feast Feature Server...")try: result = subprocess.run(['redis-cli', 'ping'], capture_output=True, text=True, timeout=5) if 'PONG' not in result.stdout: print("ERROR: Redis is not running!") sys.exit(1) print("✓ Redis is running")except: print("ERROR: Cannot connect to Redis") sys.exit(1)print("Starting Feast server on 0.0.0.0:6566...")subprocess.run(['feast', 'serve', '--host', '0.0.0.0', '--port', '6566'])Why this file is usefulIt wraps Feast server startup with a simple Redis check, so the server is not started blindly.What it doeschecks Redis healthexits early if Redis is unavailablelaunches Feast server on port 6566Why port 6566This is the serving port used in the lab for the Feast feature server.9. Step-by-step workflow after infrastructure creationOnce pulumi up is successful and EC2 outputs are available, the practical configuration flow is:Step 1: Connect to the Feast serverUsing the exported public IP:ssh -i MyKeyPair.pem ubuntu@Step 2: Fix package repository issues if neededDuring the lab, repository mirror issues occurred. The working mirror used was archive.ubuntu.com.Step 3: Install Redissudo apt updatesudo apt install redis-server -ysudo systemctl enable redissudo systemctl start redisredis-cli pingExpected:PONGWhyRedis is the online store for Feast.Step 4: Install Minicondawget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.shbash miniconda.shsource ~/.bashrcconda --versionWhyConda creates an isolated environment for Feast and dependencies.Step 5: Accept Conda termsconda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/mainconda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/rWhyThis avoids blocked package operations during Conda usage.Step 6: Create Feast environmentconda create -n feast python=3.10 -yconda activate feastWhyThis isolates Feast and avoids package conflicts.Step 7: Install Feast and required librariespip install feast pandas numpy redis pymongo pyarrow scikit-learnWhyThese packages support:Feastdataframe creationParquet file generationRedis connectivityStep 8: Create Feast repo structuremkdir -p ~/fraud_detection_pipeline/fraud_detection_features/datacd ~/fraud_detection_pipeline/fraud_detection_featuresWhyProvides an organized local Feast repository.Step 9: Create feature_store.yamlPut the exact file content shown earlier or copy from git repoWhyDefines Feast project configuration.Step 10: Initial registry setupfeast applyWhat it doesCreates or updates the Feast registry.At this stage, no features may be registered yet, so entity and feature-view lists may still be empty.Step 11: Create test_features.pyPut the exact file content shown earlier.WhyDefines the entity and feature view.Step 12: Create test_data.parquetRun the Python block shown earlier.WhyProvides the physical offline dataset required by the FileSource.Step 13: Apply againfeast applyWhat it does nowreads Python definitionsvalidates Parquet sourceregisters entity and feature viewdeploys Feast metadata for test_featuresStep 14: Validatefeast entities listfeast feature-views listls -l test_data.parquetredis-cli pingExpected:entity test_idfeature view test_featuresparquet file existsRedis returns PONGStep 15: Start the Feast serverpython3 start_feast.pyExpected output includes:Redis is runningListening at 0.0.0.0:6566Application startup completeStep 16: Validate listening portIn another session:ss -tulpn | grep 6566Expected:Feast process listening on 656610. Problems faced and how they were resolvedThis is one of the most valuable parts of the documentation because it reflects real-world troubleshooting.10.1 Problem: apt hanging on Ubuntu repositoriesSymptomapt update got stuck with:Waiting for headersconnection reset issuesinconsistent mirror responseCauseThere were network and mirror-related issues, including:IPv6 behaviorunstable mirror selectionAWS EC2 regional mirror problemsResolutionThe effective resolution was to use a stable Ubuntu archive mirror instead of the problematic EC2 regional mirror.10.2 Problem: broken EC2 Ubuntu mirrorSymptomErrors like:503 Service Unavailablefailures from ap-southeast-1.ec2.archive.ubuntu.comCauseThe regional mirror was unstable or unavailable.ResolutionThe repository source was changed to:http://archive.ubuntu.com/ubuntuThis allowed package installation to proceed normally.10.3 Problem: Feast server in private subnet could not reliably install dependenciesSymptomNetwork access from the Feast server was problematic.CauseThe private subnet path with NAT introduced avoidable lab friction.ResolutionFor lab practicality, the Feast server was moved to the public subnet with a public IP. This simplified installation and debugging.Practical lessonIn production, private subnets are preferred. In labs, public placement can be acceptable for faster iteration.10.4 Problem: missing scripts/feast-install.shSymptomPulumi failed because user_data referenced a non-existent file.CauseThe infrastructure code expected a bootstrap script that was not present.ResolutionThe user_data approach was removed and installation was performed manually after provisioning.10.5 Problem: missing test_data.parquetSymptomfeast apply failed with FileNotFoundError.CauseThe FileSource pointed to test_data.parquet, but the file did not exist.ResolutionA sample Parquet dataset was created using pandas.10.6 Problem: Feast version mismatch for entity typeSymptomvalue_type=Int64 caused type errors.Causeour installed Feast version expected ValueType.INT64 rather than feast.types.Int64 for entity value type.ResolutionThe entity definition was changed to:value_type=ValueType.INT6411. What feast apply actually doesThis command is central to Feast.When you run:feast applyFeast:reads feature_store.yamlloads repository Python definitionsvalidates data sourcesupdates the registryregisters entities and feature viewsprepares infrastructure mappings for online/offline servingIn simple language:feast apply tells Feast to reconcile our code-defined features with the feature store’s metadata state.12. What feast serve actually doesWhen we run:feast serve --host 0.0.0.0 --port 6566Feast starts a serving API backed by FastAPI and Gunicorn/Uvicorn.This creates a runtime server that can serve feature requests.In our output, the following lines confirmed success:Gunicorn startedlistening on 0.0.0.0:6566application startup complete13. Final validated working stateOur lab was proven successful through:feast versionfeast entities listfeast feature-views listredis-cli pingss -tulpn | grep 6566HTTP response from 127.0.0.1:6566Even though the root / returned:{"detail":"Not Found"}that was still valid because it proved:HTTP server was reachableapplication was aliveonly the root route was not implemented14. Professional summary of what you builtWe built a working Feast-based Feature Store on AWS with:infrastructure provisioned by PulumiRedis used as the online storeParquet used as the offline file sourcea local Feast registrya registered entity and feature viewa running Feast Feature Server on port 6566This demonstrates the core Feature Store pattern of:centralized feature definitionoffline/online store separationreproducible infrastructureAPI-based serving15. Interview-friendly explanationA concise professional explanation would be:We have implemented a Feature Store using Feast on AWS. We provisioned the infrastructure using Pulumi, configured Redis as the online store and a Parquet-based file source for offline feature data, defined entities and feature views, applied them to the Feast registry, and launched the Feast feature server for serving features over an API. This setup demonstrates how Feature Stores help maintain consistency between model training and real-time inference.16. ConclusionThis lab successfully demonstrates both the theoretical importance and the practical implementation of a Feature Store using Feast on AWS.From a theoretical perspective, the lab shows why Feature Stores are necessary in modern machine learning systems. They help solve one of the most common production challenges in ML: ensuring that the features used during model training remain consistent with the features used during real-time inference. By centralizing feature definitions, separating online and offline storage, and introducing a reusable feature management layer, Feature Stores reduce duplication, improve governance, and minimize training-serving skew.From a practical perspective, this lab shows how those ideas can be implemented end to end. Using Pulumi, the AWS infrastructure was provisioned in a reproducible way. Using Redis, an online store was configured for low-latency access. Using a Parquet file, an offline feature source was defined for historical data. Using Feast, entities and feature views were declared, applied to the registry, and served through a running Feature Server on port 6566.The lab also highlights an important real-world lesson: successful MLOps work is not only about writing application logic, but also about understanding infrastructure, networking, package management, dependency compatibility, and troubleshooting. Issues such as repository mirror failures, subnet design decisions, missing source files, and SDK version mismatches all had to be resolved before the Feature Store became operational. This reflects what often happens in real deployment environments.By completing this setup, the learner gains a strong foundational understanding of:What a Feature Store isWhy Feast is usedHow online and offline feature storage work togetherHow to define and register entities and feature viewsHow to validate a working Feast serverHow cloud infrastructure and feature-serving components connect in an MLOps workflowIn conclusion, this lab provides a solid starting point for understanding Feature Store architecture and Feast configuration. It is not only a working implementation, but also a foundational learning model that can later be extended toward more advanced scenarios such as S3-based offline stores, Kubernetes deployment, CI/CD automation, and full integration into production MLOps pipelines.Github link:GitHub - faizulkhan56/feast-labComplete One-Stop Guideline: Feature Store Theory and Feast Configuration on AWS was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.