#
ctp-product-importer [deploy]
:
Deploy Product Importer for Commercetools
#
Introduction
To use the product importer separately from the Commercetools ImpEx, Rocket offers the possibility to use an importer employing a S3 bucket and a Lambda function. The importer will get triggered by a .zip
upload to the S3 bucket and will import the products into Commercetools.
To import the products, Rocket uses the Commercetools CLI tool sphere-node-product-csv-sync.
The importer is created with the following command:
rocket aws ctp-product-importer deploy
Warning
The importer should only be used for the initial import of new products and not for updating existing products. If you want to update existing products, you should use the ImpEx from Commercetools. Also have a look at Rockets ImpEx documentation if that is what you are looking for.
#
Deploy the product importer
#
Step 1: Create clients in Commercetools
In order to create the proxy, the proxy needs certain environment variables use the sphere-node-product-csv-sync.
These environment variables are created in the clients step. Once the step has been successfully executed, the product importer has all the information it needs for Commercetools from the .env
file. It uses the CTP_ADMIN_...
environments.
#
Step 2: Choose your AWS profile
To deploy something to AWS you need config files. You can find out how this works in the AWS documentation.
You can select a AWS profile with the following command:
export AWS_PROFILE=your-profile
set AWS_PROFILE=your-profile
#
Step 3: Deploy the Product Importer stacks
To deploy the product importer, you can use the following command:
rocket aws ctp-product-importer deploy
This command will create 1 S3 bucket and 1 Lambda function. The Lambda function will be triggered by a .zip
upload to the S3 bucket.
#
How to use the Product Importer
To use the product importer, you have to create a .zip
file with the following structure and upload it to the S3 bucket.
The .zip
file can contain multiple .csv
files.
You can for example create a products.csv
file with the products you want to import. Have a look at the sphere-node-product-csv-sync documentation to see how the products.csv
file has to look like.