The app.py file contains the lambda function that is triggered by AWS Event Bridge when a new order is created in Shopify. The function then calls the Google Ads API to create a conversion event for the order.
You must have an .env file in the root directory of the project with the variables described in update_env_vars.py. Please refer to the Google Ads API documentation for more information on how to create the Google Ads API credentials. The google ads functions code comes from Google's documentation.
You may create the function either via AWS UI or via the AWS CLI.
aws lambda create-function --function-name test-python-lambda --code ImageUri=<registry URI>:<image version> --role <IAM Role> --package-type Image
Modify the update_env_vars.py file to include the correct values for yout application. Then run the following command to update the .env file with the correct values:
/.upload_to_aws.sh
The script will:
- Build the Docker image
- Tag the image
- Push the image to AWS ECR
- Update the AWS Lambda function with the new image
Run the following command to update the AWS Lambda function with the values from the .env file:
/.update_lambda_vars.sh
The script will:
- Read the .env file
- Update the AWS Lambda function with the values from the .env file