Welcome to Pulumi Registry, your window into the cloud. Read the announcement.

AWS Classic

v4.25.0 published on Friday, Oct 15, 2021 by Pulumi

Association

Provides a License Manager association.

Note: License configurations can also be associated with launch templates by specifying the license_specifications block for an aws.ec2.LaunchTemplate.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var exampleAmi = Output.Create(Aws.Ec2.GetAmi.InvokeAsync(new Aws.Ec2.GetAmiArgs
        {
            MostRecent = true,
            Owners = 
            {
                "amazon",
            },
            Filters = 
            {
                new Aws.Ec2.Inputs.GetAmiFilterArgs
                {
                    Name = "name",
                    Values = 
                    {
                        "amzn-ami-vpc-nat*",
                    },
                },
            },
        }));
        var exampleInstance = new Aws.Ec2.Instance("exampleInstance", new Aws.Ec2.InstanceArgs
        {
            Ami = exampleAmi.Apply(exampleAmi => exampleAmi.Id),
            InstanceType = "t2.micro",
        });
        var exampleLicenseConfiguration = new Aws.LicenseManager.LicenseConfiguration("exampleLicenseConfiguration", new Aws.LicenseManager.LicenseConfigurationArgs
        {
            LicenseCountingType = "Instance",
        });
        var exampleAssociation = new Aws.LicenseManager.Association("exampleAssociation", new Aws.LicenseManager.AssociationArgs
        {
            LicenseConfigurationArn = exampleLicenseConfiguration.Arn,
            ResourceArn = exampleInstance.Arn,
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v4/go/aws/ec2"
	"github.com/pulumi/pulumi-aws/sdk/v4/go/aws/licensemanager"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		opt0 := true
		exampleAmi, err := ec2.LookupAmi(ctx, &ec2.LookupAmiArgs{
			MostRecent: &opt0,
			Owners: []string{
				"amazon",
			},
			Filters: []ec2.GetAmiFilter{
				ec2.GetAmiFilter{
					Name: "name",
					Values: []string{
						"amzn-ami-vpc-nat*",
					},
				},
			},
		}, nil)
		if err != nil {
			return err
		}
		exampleInstance, err := ec2.NewInstance(ctx, "exampleInstance", &ec2.InstanceArgs{
			Ami:          pulumi.String(exampleAmi.Id),
			InstanceType: pulumi.String("t2.micro"),
		})
		if err != nil {
			return err
		}
		exampleLicenseConfiguration, err := licensemanager.NewLicenseConfiguration(ctx, "exampleLicenseConfiguration", &licensemanager.LicenseConfigurationArgs{
			LicenseCountingType: pulumi.String("Instance"),
		})
		if err != nil {
			return err
		}
		_, err = licensemanager.NewAssociation(ctx, "exampleAssociation", &licensemanager.AssociationArgs{
			LicenseConfigurationArn: exampleLicenseConfiguration.Arn,
			ResourceArn:             exampleInstance.Arn,
		})
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_aws as aws

example_ami = aws.ec2.get_ami(most_recent=True,
    owners=["amazon"],
    filters=[aws.ec2.GetAmiFilterArgs(
        name="name",
        values=["amzn-ami-vpc-nat*"],
    )])
example_instance = aws.ec2.Instance("exampleInstance",
    ami=example_ami.id,
    instance_type="t2.micro")
example_license_configuration = aws.licensemanager.LicenseConfiguration("exampleLicenseConfiguration", license_counting_type="Instance")
example_association = aws.licensemanager.Association("exampleAssociation",
    license_configuration_arn=example_license_configuration.arn,
    resource_arn=example_instance.arn)
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const exampleAmi = aws.ec2.getAmi({
    mostRecent: true,
    owners: ["amazon"],
    filters: [{
        name: "name",
        values: ["amzn-ami-vpc-nat*"],
    }],
});
const exampleInstance = new aws.ec2.Instance("exampleInstance", {
    ami: exampleAmi.then(exampleAmi => exampleAmi.id),
    instanceType: "t2.micro",
});
const exampleLicenseConfiguration = new aws.licensemanager.LicenseConfiguration("exampleLicenseConfiguration", {licenseCountingType: "Instance"});
const exampleAssociation = new aws.licensemanager.Association("exampleAssociation", {
    licenseConfigurationArn: exampleLicenseConfiguration.arn,
    resourceArn: exampleInstance.arn,
});

Create a Association Resource

new Association(name: string, args: AssociationArgs, opts?: CustomResourceOptions);
@overload
def Association(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                license_configuration_arn: Optional[str] = None,
                resource_arn: Optional[str] = None)
@overload
def Association(resource_name: str,
                args: AssociationArgs,
                opts: Optional[ResourceOptions] = None)
func NewAssociation(ctx *Context, name string, args AssociationArgs, opts ...ResourceOption) (*Association, error)
public Association(string name, AssociationArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args AssociationArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args AssociationArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args AssociationArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args AssociationArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

Association Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The Association resource accepts the following input properties:

LicenseConfigurationArn string
ARN of the license configuration.
ResourceArn string
ARN of the resource associated with the license configuration.
LicenseConfigurationArn string
ARN of the license configuration.
ResourceArn string
ARN of the resource associated with the license configuration.
licenseConfigurationArn string
ARN of the license configuration.
resourceArn string
ARN of the resource associated with the license configuration.
license_configuration_arn str
ARN of the license configuration.
resource_arn str
ARN of the resource associated with the license configuration.

Outputs

All input properties are implicitly available as output properties. Additionally, the Association resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.

Look up an Existing Association Resource

Get an existing Association resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: AssociationState, opts?: CustomResourceOptions): Association
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        license_configuration_arn: Optional[str] = None,
        resource_arn: Optional[str] = None) -> Association
func GetAssociation(ctx *Context, name string, id IDInput, state *AssociationState, opts ...ResourceOption) (*Association, error)
public static Association Get(string name, Input<string> id, AssociationState? state, CustomResourceOptions? opts = null)
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.

The following state arguments are supported:

LicenseConfigurationArn string
ARN of the license configuration.
ResourceArn string
ARN of the resource associated with the license configuration.
LicenseConfigurationArn string
ARN of the license configuration.
ResourceArn string
ARN of the resource associated with the license configuration.
licenseConfigurationArn string
ARN of the license configuration.
resourceArn string
ARN of the resource associated with the license configuration.
license_configuration_arn str
ARN of the license configuration.
resource_arn str
ARN of the resource associated with the license configuration.

Import

License configurations can be imported in the form resource_arn,license_configuration_arn, e.g.

 $ pulumi import aws:licensemanager/association:Association example arn:aws:ec2:eu-west-1:123456789012:image/ami-123456789abcdef01,arn:aws:license-manager:eu-west-1:123456789012:license-configuration:lic-0123456789abcdef0123456789abcdef

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.