Skip to content

Instantly share code, notes, and snippets.

@robisatthefunction
Last active March 20, 2023 15:33
Show Gist options
  • Save robisatthefunction/b5847decabe2a76c1ebd30aa5ddf5520 to your computer and use it in GitHub Desktop.
Save robisatthefunction/b5847decabe2a76c1ebd30aa5ddf5520 to your computer and use it in GitHub Desktop.
import boto3
# Get AWS credentials from your Optimizely Interface https://docs.developers.optimizely.com/web/docs/customer-profiles#bulk-upload
client = boto3.client(
's3',
aws_access_key_id = '',
aws_secret_access_key = ''
)
# https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-bucket-intro.html
# https://boto3.amazonaws.com/v1/documentation/api/latest/guide/s3-uploading-files.html
file_name = 'customer_data.csv' # Your customer data in current folder
bucket_name = 'optimizely-import'
# Get dcp_serviceId and datasourceId from Optimizely UI. Reach out to Optimizely support if you do not know where those exist.
s3_path = 'dcp/<dcp_serviceId>/<datasourceId>/customer_data.csv'
client.upload_file(Filename=file_name, Bucket=bucket_name, Key=s3_path)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment