1. Packages
  2. AWS Classic
  3. API Docs
  4. licensemanager
  5. Association

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi

aws.licensemanager.Association

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi

    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

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = aws.ec2.getAmi({
        mostRecent: true,
        owners: ["amazon"],
        filters: [{
            name: "name",
            values: ["amzn-ami-vpc-nat*"],
        }],
    });
    const exampleInstance = new aws.ec2.Instance("example", {
        ami: example.then(example => example.id),
        instanceType: aws.ec2.InstanceType.T2_Micro,
    });
    const exampleLicenseConfiguration = new aws.licensemanager.LicenseConfiguration("example", {
        name: "Example",
        licenseCountingType: "Instance",
    });
    const exampleAssociation = new aws.licensemanager.Association("example", {
        licenseConfigurationArn: exampleLicenseConfiguration.arn,
        resourceArn: exampleInstance.arn,
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.ec2.get_ami(most_recent=True,
        owners=["amazon"],
        filters=[{
            "name": "name",
            "values": ["amzn-ami-vpc-nat*"],
        }])
    example_instance = aws.ec2.Instance("example",
        ami=example.id,
        instance_type=aws.ec2.InstanceType.T2_MICRO)
    example_license_configuration = aws.licensemanager.LicenseConfiguration("example",
        name="Example",
        license_counting_type="Instance")
    example_association = aws.licensemanager.Association("example",
        license_configuration_arn=example_license_configuration.arn,
        resource_arn=example_instance.arn)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/licensemanager"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := ec2.LookupAmi(ctx, &ec2.LookupAmiArgs{
    			MostRecent: pulumi.BoolRef(true),
    			Owners: []string{
    				"amazon",
    			},
    			Filters: []ec2.GetAmiFilter{
    				{
    					Name: "name",
    					Values: []string{
    						"amzn-ami-vpc-nat*",
    					},
    				},
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		exampleInstance, err := ec2.NewInstance(ctx, "example", &ec2.InstanceArgs{
    			Ami:          pulumi.String(example.Id),
    			InstanceType: pulumi.String(ec2.InstanceType_T2_Micro),
    		})
    		if err != nil {
    			return err
    		}
    		exampleLicenseConfiguration, err := licensemanager.NewLicenseConfiguration(ctx, "example", &licensemanager.LicenseConfigurationArgs{
    			Name:                pulumi.String("Example"),
    			LicenseCountingType: pulumi.String("Instance"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = licensemanager.NewAssociation(ctx, "example", &licensemanager.AssociationArgs{
    			LicenseConfigurationArn: exampleLicenseConfiguration.Arn,
    			ResourceArn:             exampleInstance.Arn,
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Aws.Ec2.GetAmi.Invoke(new()
        {
            MostRecent = true,
            Owners = new[]
            {
                "amazon",
            },
            Filters = new[]
            {
                new Aws.Ec2.Inputs.GetAmiFilterInputArgs
                {
                    Name = "name",
                    Values = new[]
                    {
                        "amzn-ami-vpc-nat*",
                    },
                },
            },
        });
    
        var exampleInstance = new Aws.Ec2.Instance("example", new()
        {
            Ami = example.Apply(getAmiResult => getAmiResult.Id),
            InstanceType = Aws.Ec2.InstanceType.T2_Micro,
        });
    
        var exampleLicenseConfiguration = new Aws.LicenseManager.LicenseConfiguration("example", new()
        {
            Name = "Example",
            LicenseCountingType = "Instance",
        });
    
        var exampleAssociation = new Aws.LicenseManager.Association("example", new()
        {
            LicenseConfigurationArn = exampleLicenseConfiguration.Arn,
            ResourceArn = exampleInstance.Arn,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.ec2.Ec2Functions;
    import com.pulumi.aws.ec2.inputs.GetAmiArgs;
    import com.pulumi.aws.ec2.Instance;
    import com.pulumi.aws.ec2.InstanceArgs;
    import com.pulumi.aws.licensemanager.LicenseConfiguration;
    import com.pulumi.aws.licensemanager.LicenseConfigurationArgs;
    import com.pulumi.aws.licensemanager.Association;
    import com.pulumi.aws.licensemanager.AssociationArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var example = Ec2Functions.getAmi(GetAmiArgs.builder()
                .mostRecent(true)
                .owners("amazon")
                .filters(GetAmiFilterArgs.builder()
                    .name("name")
                    .values("amzn-ami-vpc-nat*")
                    .build())
                .build());
    
            var exampleInstance = new Instance("exampleInstance", InstanceArgs.builder()
                .ami(example.applyValue(getAmiResult -> getAmiResult.id()))
                .instanceType("t2.micro")
                .build());
    
            var exampleLicenseConfiguration = new LicenseConfiguration("exampleLicenseConfiguration", LicenseConfigurationArgs.builder()
                .name("Example")
                .licenseCountingType("Instance")
                .build());
    
            var exampleAssociation = new Association("exampleAssociation", AssociationArgs.builder()
                .licenseConfigurationArn(exampleLicenseConfiguration.arn())
                .resourceArn(exampleInstance.arn())
                .build());
    
        }
    }
    
    resources:
      exampleInstance:
        type: aws:ec2:Instance
        name: example
        properties:
          ami: ${example.id}
          instanceType: t2.micro
      exampleLicenseConfiguration:
        type: aws:licensemanager:LicenseConfiguration
        name: example
        properties:
          name: Example
          licenseCountingType: Instance
      exampleAssociation:
        type: aws:licensemanager:Association
        name: example
        properties:
          licenseConfigurationArn: ${exampleLicenseConfiguration.arn}
          resourceArn: ${exampleInstance.arn}
    variables:
      example:
        fn::invoke:
          Function: aws:ec2:getAmi
          Arguments:
            mostRecent: true
            owners:
              - amazon
            filters:
              - name: name
                values:
                  - amzn-ami-vpc-nat*
    

    Create Association Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

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

    Parameters

    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.
    name String
    The unique name of the resource.
    args AssociationArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var associationResource = new Aws.LicenseManager.Association("associationResource", new()
    {
        LicenseConfigurationArn = "string",
        ResourceArn = "string",
    });
    
    example, err := licensemanager.NewAssociation(ctx, "associationResource", &licensemanager.AssociationArgs{
    	LicenseConfigurationArn: pulumi.String("string"),
    	ResourceArn:             pulumi.String("string"),
    })
    
    var associationResource = new Association("associationResource", AssociationArgs.builder()
        .licenseConfigurationArn("string")
        .resourceArn("string")
        .build());
    
    association_resource = aws.licensemanager.Association("associationResource",
        license_configuration_arn="string",
        resource_arn="string")
    
    const associationResource = new aws.licensemanager.Association("associationResource", {
        licenseConfigurationArn: "string",
        resourceArn: "string",
    });
    
    type: aws:licensemanager:Association
    properties:
        licenseConfigurationArn: string
        resourceArn: string
    

    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.
    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.
    licenseConfigurationArn String
    ARN of the license configuration.
    resourceArn String
    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 string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up 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)
    public static Association get(String name, Output<String> id, AssociationState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    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.
    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.
    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.
    licenseConfigurationArn String
    ARN of the license configuration.
    resourceArn String
    ARN of the resource associated with the license configuration.

    Import

    Using pulumi import, import license configurations using resource_arn,license_configuration_arn. For example:

    $ 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
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi