
Step 1: Create an S3 Bucket
Create a dedicated S3 bucket for this integration. We recommend includingmixpanel-import in the name to make it explicit and avoid any accidental data sharing.
You can create the bucket in any region, though it will need to be in the same region as your AWS Lambda function.
Step 2: Setup Import Config
Step 2a: Setup the Lambda Function
Create a new Lambda Function.- Select
Author From Scratch. - Select a Python runtime.
- Select
Create Function.

Step 2b: Write the Lambda Function
Change the filename fromlambda_function.py to main.py and edit the runtime settings handler to main.Handler. Paste the code below for main.py.

main.py
Step 2c: Add Trigger
Add a trigger so that your Lambda function runs whenever a new object is added to your bucket by selectingAdd trigger under Function Overview. You will want to use the bucket created in Step 2 and select All object create events.

Step 2d: Update Configurations and Deploy
SelectConfiguration > General Configuration > Edit.
- Change
Memoryto1024 MB. - Change
Timeoutto5 minutes.

Versions > Publish New Version to deploy the function. At this point, any file you upload to the bucket will trigger an invocation of the function and an import into Mixpanel. Let’s test it out!
Step 3: Test with sample data and watch the logs
Let’s test the connection with some sample events. Run the following to copy them to your bucket, which will trigger the import:gsutil cp cp gs://mixpanel-sample-data/10-events.json s3://your-s3-bucket/example.json
Monitor the logs of your Lambda Function; you should see an Import Complete log line within a minute.


test_event in the event picker, and you should see the events you just imported.
