Nhảy tới nội dung

Get started

Prerequisites

Project setup

1. Initialize CDK project

# Create project directory
mkdir personalize-cdk && cd personalize-cdk

# Initialize CDK project
cdk init app --language python

# Activate virtual environment
source .venv/bin/activate # Linux/Mac
# .venv\Scripts\activate.bat # Windows

# Install dependencies
pip install aws-cdk-lib constructs boto3 pandas

2. Update requirements

aws-cdk-lib>=2.234.1,<3.0.0
constructs>=10.0.0,<11.0.0

Architecture Diagram

┌──────────────────────────────────────────────────────────────┐
│ AWS CDK Stacks │
├──────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────┐ ┌─────────────────────────────┐ │
│ │ S3 Bucket │ │ Amazon Personalize │ │
│ │ (Data) │────▶│ - Dataset Group │ │
│ └─────────────────┘ │ - Schema │ │
│ │ - Dataset │ │
│ └─────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌──────────────────────────────────────────────────────┐ │
│ │ Step Functions Pipeline │ │
│ │ ┌─────────┐ ┌──────────┐ ┌──────────┐ │ │
│ │ │ Import │──▶│ Solution │──▶│ Campaign │ │ │
│ │ │ Job │ │ Training │ │ Deploy │ │ │
│ │ └─────────┘ └──────────┘ └──────────┘ │ │
│ └──────────────────────────────────────────────────────┘ │
│ │
└──────────────────────────────────────────────────────────────┘

Project structure

personalize-cdk/
├── app.py
├── personalize_cdk/
│ ├── __init__.py
│ ├── personalize_infra_stack.py
│ ├── personalize_pipeline_stack.py
├── interactions.csv
├── dataset_prepared.py
├── upload_data_run_pipeline.py
├── get_recommendations.py
├── requirements.txt
└── cdk.json