AWSTemplateFormatVersion: '2010-09-09' Description: This template onboards your AWS account to interact with the Amazon Selling Partner API. A sample AWS Lambda function is included. (qs-1s617385e) Parameters: QSS3BucketName: AllowedPattern: ^[0-9a-zA-Z]+([0-9a-zA-Z-]*[0-9a-zA-Z])*$ ConstraintDescription: Quick Start bucket name can include numbers, lowercase letters, uppercase letters, and hyphens (-). It cannot start or end with a hyphen (-). Default: aws-quickstart Description: Name of the S3 bucket for your copy of the Quick Start assets. Keep the default name unless you are customizing the template. Changing the name updates code references to point to a new Quick Start location. This name can include numbers, lowercase letters, uppercase letters, and hyphens, but do not start or end with a hyphen (-). See https://aws-quickstart.github.io/option1.html. Type: String QSS3KeyPrefix: AllowedPattern: ^[0-9a-zA-Z-/]*$ ConstraintDescription: Quick Start key prefix can include numbers, lowercase letters, uppercase letters, hyphens (-), and forward slash (/). Default: quickstart-amazon-selling-partner-api/ Description: S3 key prefix that is used to simulate a directory for your copy of the Quick Start assets. Keep the default prefix unless you are customizing the template. Changing this prefix updates code references to point to a new Quick Start location. This prefix can include numbers, lowercase letters, uppercase letters, hyphens (-), and forward slashes (/). End with a forward slash. See https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html and https://aws-quickstart.github.io/option1.html. Type: String Conditions: UsingDefaultBucket: !Equals [!Ref QSS3BucketName, 'aws-quickstart'] Resources: SPAPIIAMRole: Type: AWS::IAM::Role Properties: AssumeRolePolicyDocument: Version: '2012-10-17' Statement: - Effect: Allow Principal: AWS: !Sub "arn:${AWS::Partition}:iam::${AWS::AccountId}:root" Action: sts:AssumeRole Condition: {} Policies: - PolicyDocument: Version: '2012-10-17' Statement: - Effect: Allow Action: execute-api:Invoke Resource: arn:aws:execute-api:*:*:* PolicyName: SellingPartnerAPI RoleName: SPAPIIAMRole LambdaExecutionRole: Type: AWS::IAM::Role Properties: RoleName: SPAPILambdaRole AssumeRolePolicyDocument: Version: '2012-10-17' Statement: - Effect: Allow Principal: Service: lambda.amazonaws.com Action: sts:AssumeRole Policies: - PolicyName: SPDSLambdaPolicy PolicyDocument: Version: '2012-10-17' Statement: - Sid: VisualEditor0 Effect: Allow Action: - sts:AssumeRole - logs:CreateLogGroup - logs:CreateLogStream - logs:PutLogEvents Resource: '*' LambdaFunction: Type: AWS::Lambda::Function Properties: Handler: lambda_function.lambda_handler Role: !GetAtt 'LambdaExecutionRole.Arn' Code: S3Bucket: !If - UsingDefaultBucket - !Sub '${QSS3BucketName}-${AWS::Region}' - !Ref QSS3BucketName S3Key: !Sub '${QSS3KeyPrefix}functions/packages/ExampleLambda/lambda.zip' Runtime: python3.8