Programatic subscription to AWS Marketplace image

455 views Asked by At

hope everyone is fit and well !!

So this time i'm trying to launch some AWS Marketplace images using cloudformation and terraform both and it works fine on my account as i have already subscribed to these images, but it doesnt work on other account as these are not been subscribed there.

I'm looking for some way of either accepting or opting for subscription via automation ( any api or command ) and get these instances launched without fail.

i dont know if at all it is possible to create custome images from these marketplace image so that subscription can be avoided , please suggest

Thanks!!

1

There are 1 answers

0
Harsha G V On

This functionality can be achieved via

Option#1: via AWS SDK like Go:

I. aws_licensemanager_grant

CreateGrant

DeleteGrant

GetGrant

II. aws_licensemanager_license_grants data source

ListDistributedGrants

III. aws_licensemanager_grant_version

CreateGrantVersion

IV. aws_licensemanager_grant_accepter

AcceptGrant

ListReceivedGrants

RejectGrant


Option#2: via terraform, using the Terraform AWS Provider v4.58.0

Resources:

aws_licensemanager_grant 一 Allow sharing a license with another account.

aws_licensemanager_grant_accepter 一 Accepting a shared license in the target account.

Datasources:

aws_licensemanager_received_license 一 A data source to get detailed data about an accepted AWS License from the market place.

aws_licensemanager_received_licenses 一 A data source to get a list of ARNs for accepted AWS market place licenses that match a filter.

aws_licensemanager_grants 一 A data source to get a list of grant ARNs for the account matching a filter.