Data Upload and Model Train
This will be done by executing the state machine. You need to provide your bucket_name and stateMachineArn.
/upload_data_run_pipeline.py
import boto3
import pandas as pd
# Upload to S3
s3 = boto3.client('s3')
bucket_name = "personalize-data-{YOUR_ACCOUNT}-{YOUR_REGION}"
s3.upload_file('interactions.csv', bucket_name, 'data/interactions.csv')
# Start Step Functions execution
sfn_client = boto3.client('stepfunctions')
response = sfn_client.start_execution(
stateMachineArn='arn:aws:states:{YOUR_REGION}:{YOUR_ACCOUNT}:stateMachine:personalize-training-pipeline',
input='{}'
)
print(f"Pipeline started: {response['executionArn']}")