Code Monkey home page Code Monkey logo

awsmp's Introduction

awsmp

awsmp is a module and CLI tool to interact with the AWS Marketplace API.

CLI usage

The command line interface called awsmp accepts the standard AWS environment variables (e.g. AWS_PROFILE). Note that Marketplace interaction needs to happen in the us-east-1 region (which is set as the default in the CLI).

`awsmpcli` is the legacy binary name, and still available outside of snap builds

Some examples how to use the CLI.

listing and showing available offers

Available offers can be listed:

$ awsmp entity-list Offer
+---------------------------+------+------------+----------------------+
|         entity-id         | name | visibility |     last-changed     |
+---------------------------+------+------------+----------------------+
| a8t4vhju1o9ibx6hfi9bnuo2x |  ''  |   Public   | 2021-09-03T08:14:37Z |
+---------------------------+------+------------+----------------------+

Details about an available offer can be shown using the enitity-id:

$ awsmp entity-show a8t4vhju1o9ibx6hfi9bnuo2x
{'AgreementToken': 'dummy-agreement-token',
 'Description': 'Worldwide offer for JUST FOR TESTING',
 'Id': 'a8t4vhju1o9ibx6hfi9bnuo2x',
 'MarkupPercentage': None,
 'Name': None,
 ... output stripped here ...

creating a new private offer

A new private offer can be created with:

$ awsmp private-offer create \
    --product-id 3a628887-30de-4d23-a949-93b32e4e4c5f \
    --buyer-accounts 887450378614 \
    --offer-name "toabctl testing" \
    --pricing prices.csv

ChangeSet created (ID: 1mlxbdpmabfauymeeo12hg599)
https://aws.amazon.com/marketplace/management/requests/1mlxbdpmabfauymeeo12hg599

Now a new request is available in the AWS Marketplace web UI. That new request need to be in the state Succeeded before a buyer can see the offer.

The file prices.csv needs to be available and that file needs to contain all the instance types (dimensions) available in the product.

generating a prices.csv file

The awsmp private-offer create command requires a prices.csv file be available. That file contains 3 colums where the first column is the instance type, the second column is the hourly price (in USD) and the third column is the annual price.

This file can be generated from an available offer, then adjusted and used to generate a new offer. To generate the file for an available offer, do:

awsmp pricing-template \
    --offer-id offer-rsf4l7ilje2ze \
    --pricing prices.csv

This creates a prices.csv file for the offer with the entity Id offer-rsf4l7ilje2ze.

creating a new public AMI product

A new public AMI product listing can be created following steps below:

1. Create product Id .. code-block:

awsmp public-offer create

ChangeSet created (ID: gxy13m673kmhr4vdtpu0ltwf)
https://aws.amazon.com/marketplace/management/requests/gxy13m673kmhr4vdtpu0ltwf

This request will generate offer id associated with product id. Offer id is required to update instance type, legal term, release listing.

  1. Add/Edit product description

Once product id is created, you can add/edit product description. Description fields can be found below or please see the sample config file (listing_configuration.yaml)

description:
   product_title: str
   logourl: str
   video_urls: Optional[List[str]], can only have 1 url
   short_description: str
   long_description: str
   highlights: List[str]
   search_keywords: List[str]
   categories: List[str]
   support_description: str # Don't include space character at the beginning/end
   support_resources: str
   additional_resources: Optional[List[Dict[str, str]]]
   sku: Optional[str]

For empty value, please use '~' for str type and '[]' for List type

If field value does not match with file format, it will show error before updating listing

  1. Update/Add instance type 3.1 Generate instance type file (.csv) and provide as input file when updating listing.

    example instance_type.csv

    There are 2 cases you can generate instance type file.

    1. Using public-offer command If you create new listing and see what's available with given architecture and virtual type, call awsmp public-offer instance-type-template and file instance_type.csv will be created. You can remove or add instance types you want to update in the listing.

    2. Update pricing/add new available instance types To update/copying existing listing instance types or adding available instance types, we need all instance type information from the listing. (Please see below to find offer Id which is associated public product listing at the end of section)

      You can append additional instance type at the end of this file or edit pricing (hourly which is second column) information.

    3.2 Once you have instance_type csv file, update listing with command below.

    1. Free listing update .. code-block:

      awsmp public-offer update-instnace-type \
         --product-id prod-xwpv7txqxg55e \
         --offer-id offer-t4vib6xp7tb3c \
         --instance-type-file instance_type.csv \
         --dimension-unit Hrs \
         --free Y
      
    2. Paid listing update .. code-block:

      awsmp public-offer update-instnace-type \
         --product-id prod-xwpv7txqxg55e \
         --offer-id offer-t4vib6xp7tb3c \
         --instance-type-file instance_type.csv \
         --dimension-unit Hrs \
         --free N
      

    dimension-unit is unit type of billing of this product. For free listing, please put Hrs. There are different types but currently available types are Hrs, Units.

    Offer Id is needed to update pricing terms for public offer. You can find this offer id from Create product id request in Step 1. Or login AWS console, go AWS Marketplace > Manage subscriptions and click the listing to find Offer Id under Agreements.

  2. Update/Add region

Add and update region information to AMI product listing.

example listing_configuration.yaml

Gov region can't be enabled with API. Contact marketplace representative for gov region enablement

  1. Add new version

Add new Ami version Ami to listing. Sample version config can be references in listing_configuration.yaml

  1. Update legal/support Terms

Legal/Support terms update in AMI product listing requires public offer id when you created in Step 1.

example listing_configuration.yaml .. code-block:

...
eula_url: "https://eula-example"
refund_policy: |
   Absolutely no refund!
...

refund_policy is free form of text.

  1. Release AMI product listing

To release (published as limited), product id and public offer id are required.

awsmp's People

Contributors

rthill91 avatar toabctl avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.