Selling Partner API on the AWS Cloud
Quick Start Reference Deployment
Rugved Dighe, Selling Partner Services team
Andrew Glenn, AWS Integration & Automation team
|Visit our GitHub repository for source files and to post feedback, report bugs, or submit feature ideas for this Quick Start.|
This Quick Start was created by Amazon.com Services LLC in collaboration with Amazon Web Services (AWS). Quick Starts are automated reference deployments that use AWS CloudFormation templates to deploy key technologies on AWS, following AWS best practices.
This guide provides instructions for deploying the Selling Partner API (SP-API) Quick Start reference architecture on the AWS Cloud. It is for users who want to set up AWS resources in their AWS account to provide SP-API integration using AWS best practices.
|Amazon may share user-deployment information with the AWS Partner that collaborated with AWS on the Quick Start.|
Selling Partner API on AWS
This Quick Start deploys SP-API on the Amazon Web Services (AWS) Cloud. It configures an AWS Identity and Access Management (IAM) role to streamline your SP-API onboarding. In addition, it provides a sample AWS Lambda application to demonstrate AWS best practices for SP-API integration. After deployment, input your application’s client identifier, secret, and seller refresh token into the sample application code to test connectivity to SP-API endpoints. For more information, see Post-deployment steps later in this guide.
SP-API is a suite of REST-based APIs providing Amazon Selling Partners programmatic access to their Amazon Seller Central account data. With it, you can build applications that help sellers and vendors manage their Amazon business. You must have a Professional selling plan on Amazon Seller Central and register as a developer to create Seller Central applications.
For more information on SP-API, see the Selling Partner API documentations repository.
You are responsible for the cost of the AWS services and any third-party licenses used while running this Quick Start. There is no additional cost for using the Quick Start.
The AWS CloudFormation templates for Quick Starts include configuration parameters that you can customize. Some of the settings, such as the instance type, affect the cost of deployment. For cost estimates, see the pricing pages for each AWS service you use. Prices are subject to change.
|After you deploy the Quick Start, create AWS Cost and Usage Reports to deliver billing metrics to an Amazon Simple Storage Service (Amazon S3) bucket in your account. These reports provide cost estimates based on usage throughout each month and aggregate the data at the end of the month. For more information, see What are AWS Cost and Usage Reports?|
No additional licenses are required to use this Quick Start.
Deploying this Quick Start with default parameters builds the following SP-API environment in the AWS Cloud.
As shown in Figure 1, the Quick Start sets up the following:
An AWS IAM role providing a secure way to interact with SP-API.
An AWS Lambda function to use the IAM role to call SP-SPI endpoints.
Planning the deployment
This deployment requires a moderate level of familiarity with AWS services. If you’re new to AWS, see Getting Started Resource Center and AWS Training and Certification. These sites provide materials for learning how to design, deploy, and operate your infrastructure and applications on the AWS Cloud.
This Quick Start assumes familiarity with Selling Partner API. For more information on SP-API, see the Selling Partner API documentations repository.
If you don’t already have an AWS account, create one at https://aws.amazon.com by following the on-screen instructions. Part of the sign-up process involves receiving a phone call and entering a PIN using the phone keypad.
Your AWS account is automatically signed up for all AWS services. You are charged only for the services you use.
Before you launch the Quick Start, review the following information and ensure that your account is properly configured. Otherwise, deployment might fail.
If necessary, request service quota increases for the following resources. You might need to request increases if your existing deployment currently uses these resources and if this Quick Start deployment could result in exceeding the default quotas. The Service Quotas console displays your usage and quotas for some aspects of some services. For more information, see What is Service Quotas? and AWS service quotas.
|Resource||This deployment uses|
AWS Lambda functions
Supported AWS Regions
For any Quick Start to work in a Region other than its default Region, all the services it deploys must be supported in that Region. You can launch a Quick Start in any Region and see if it works. If you get an error such as “Unrecognized resource type,” the Quick Start is not supported in that Region.
For an up-to-date list of AWS Regions and the AWS services they support, see AWS Regional Services.
|Certain Regions are available on an opt-in basis. For more information, see Managing AWS Regions.|
Before launching the Quick Start, you must sign in to the AWS Management Console with IAM permissions for the resources that the templates deploy. The AdministratorAccess managed policy within IAM provides sufficient permissions, although your organization may choose to use a custom policy with more restrictions. For more information, see AWS managed policies for job functions.
Prepare your Seller Central account
This Quick Start provides one deployment option:
Deploy SP-API into an existing VPC. This option provisions SP-API in your existing AWS infrastructure.
Confirm your AWS account configuration
Launch the Quick Start
Each deployment takes about 5 minutes to complete. Sign in to your AWS account, and choose the following option to launch the AWS CloudFormation template.
Check the AWS Region that’s displayed in the upper-right corner of the navigation bar, and change it if necessary. This Region is where you build the network infrastructure. The template is launched in the us-east-1 Region by default. For more information, see Supported AWS Regions earlier in this guide.
On the Create stack page, keep the default setting for the template URL, and then choose Next.
On the Specify stack details page, change the stack name if needed. When you finish reviewing, choose Next.
On the Review page, review and confirm the template settings. Under Capabilities, select the two check boxes to acknowledge that the template creates IAM resources and might require the ability to automatically expand macros.
Choose Create stack to deploy the stack.
Monitor the status of the stack. When the status is CREATE_COMPLETE, the SP-API deployment is ready.
To view the created resources, see the values displayed in the Outputs tab for the stack.
Copy the IAM role ARN
Open the AWS IAM console.
In the navigation pane, choose Roles.
Choose the name of the role that you will use to create the application.
Copy the role Amazon Resource Number (ARN).
Register an app on Seller Central
Sign into Seller Central using the credentials that you used to register as a developer.
Choose Develop Apps from the Apps & Services menu.
Choose Add new app client.
On the App registration page, enter an app name.
Choose SP API from the API Type drop-down list.
For IAM ARN, enter the role ARN you copied previously.
Choose the pertinent application roles.
Enter OAuth login and redirect URIs. These parameters are optional for private seller and vendor applications.
Choose Save and exit.
Choose Develop Apps from the Apps & Services menu.
Choose View under LWA credentials for the app you registered previously.
Copy the client identifier and client secret. You will enter these on lines 26 and 27, respectively, of lambda_function.py later.
Obtain seller authorization
Edit and test the AWS Lambda function
Open the AWS Lambda console.
In the navigation pane, choose Functions.
Choose the name of the Lambda function created by the Selling Partner API Quick Start.
On the Code tab, choose lambda_function.py in Environment window.
On line 26, enter the client identifier you copied previously.
On line 27, enter the client secret.
On line 32, enter the refresh token you received previously from the seller.
On the Configure test event dialog box, enter an event name, and choose Create.
Choose Test. The Execution results tab shows the status and details of the test.
Best practices for using SP API on AWS
For more information about SP-API best practices, see the Selling Partner API Developer Guide.
Use of an IAM role with permission to call SP-API is a best practice.
The temporary credentials received from the IAM role are valid only for one hour.
Q. I encountered a CREATE_FAILED error when I launched the Quick Start.
A. If AWS CloudFormation fails to create the stack, relaunch the template with Rollback on failure set to Disabled. This setting is under Advanced in the AWS CloudFormation console on the Configure stack options page. With this setting, the stack’s state is retained, and the instance keeps running so that you can troubleshoot the issue. (For Windows, look at the log files in %ProgramFiles%\Amazon\EC2ConfigService and C:\cfn\log.)
|When you set Rollback on failure to Disabled, you continue to incur AWS charges for this stack. Delete the stack when you finish troubleshooting.|
For more information, see Troubleshooting AWS CloudFormation.
Q. I encountered a size-limitation error when I deployed the AWS CloudFormation templates.
A. Launch the Quick Start templates from the links in this guide or from another S3 bucket. If you deploy the templates from a local copy on your computer or from a location other than an S3 bucket, you might encounter template-size limitations. For more information, see AWS CloudFormation quotas.
Q. I cannot create an app on Seller Central.
Q. How do I get the refresh token to test the API call?
Q. I cant see any orders in the API response. What do I do?
A. If you are a third-party developer, you must add the refresh token from the seller to lambda_function.py. For more information, see Post-deployment steps. If you self-authorized your application, the API response will not contain orders.
Q. I sell in multiple marketplaces on Amazon Seller Central, why do I only see orders for a single marketplace?
A. This Quick Start deployment makes a call to get orders in the first marketplace in a seller’s marketplace list. For more information, see Choose your source and target marketplaces.
After you successfully deploy this Quick Start, confirm that your resources and services are updated and configured — including any required patches — to meet your security and other needs. For more information, see the AWS Shared Responsibility Model.
Send us feedback
Quick Start reference deployments
See the AWS Quick Start home page.
Visit our GitHub repository to download the templates and scripts for this Quick Start, to post your comments, and to share your customizations with others.
This document is provided for informational purposes only. It represents AWS’s current product offerings and practices as of the date of issue of this document, which are subject to change without notice. Customers are responsible for making their own independent assessment of the information in this document and any use of AWS’s products or services, each of which is provided “as is” without warranty of any kind, whether expressed or implied. This document does not create any warranties, representations, contractual commitments, conditions, or assurances from AWS, its affiliates, suppliers, or licensors. The responsibilities and liabilities of AWS to its customers are controlled by AWS agreements, and this document is not part of, nor does it modify, any agreement between AWS and its customers.
The software included with this paper is licensed under the Apache License, version 2.0 (the "License"). You may not use this file except in compliance with the License. A copy of the License is located at http://aws.amazon.com/apache2.0/ or in the accompanying "license" file. This code is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either expressed or implied. See the License for specific language governing permissions and limitations.