1. Packages
  2. AWS
  3. API Docs
  4. opensearch
  5. PackageAssociation
AWS v6.78.0 published on Thursday, Apr 24, 2025 by Pulumi

aws.opensearch.PackageAssociation

Explore with Pulumi AI

Manages an AWS Opensearch Package Association.

Example Usage

Basic Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const myDomain = new aws.opensearch.Domain("my_domain", {
    domainName: "my-opensearch-domain",
    engineVersion: "Elasticsearch_7.10",
    clusterConfig: {
        instanceType: "r4.large.search",
    },
});
const example = new aws.opensearch.Package("example", {
    packageName: "example-txt",
    packageSource: {
        s3BucketName: myOpensearchPackages.bucket,
        s3Key: exampleAwsS3Object.key,
    },
    packageType: "TXT-DICTIONARY",
});
const examplePackageAssociation = new aws.opensearch.PackageAssociation("example", {
    packageId: example.id,
    domainName: myDomain.domainName,
});
Copy
import pulumi
import pulumi_aws as aws

my_domain = aws.opensearch.Domain("my_domain",
    domain_name="my-opensearch-domain",
    engine_version="Elasticsearch_7.10",
    cluster_config={
        "instance_type": "r4.large.search",
    })
example = aws.opensearch.Package("example",
    package_name="example-txt",
    package_source={
        "s3_bucket_name": my_opensearch_packages["bucket"],
        "s3_key": example_aws_s3_object["key"],
    },
    package_type="TXT-DICTIONARY")
example_package_association = aws.opensearch.PackageAssociation("example",
    package_id=example.id,
    domain_name=my_domain.domain_name)
Copy
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/opensearch"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		myDomain, err := opensearch.NewDomain(ctx, "my_domain", &opensearch.DomainArgs{
			DomainName:    pulumi.String("my-opensearch-domain"),
			EngineVersion: pulumi.String("Elasticsearch_7.10"),
			ClusterConfig: &opensearch.DomainClusterConfigArgs{
				InstanceType: pulumi.String("r4.large.search"),
			},
		})
		if err != nil {
			return err
		}
		example, err := opensearch.NewPackage(ctx, "example", &opensearch.PackageArgs{
			PackageName: pulumi.String("example-txt"),
			PackageSource: &opensearch.PackagePackageSourceArgs{
				S3BucketName: pulumi.Any(myOpensearchPackages.Bucket),
				S3Key:        pulumi.Any(exampleAwsS3Object.Key),
			},
			PackageType: pulumi.String("TXT-DICTIONARY"),
		})
		if err != nil {
			return err
		}
		_, err = opensearch.NewPackageAssociation(ctx, "example", &opensearch.PackageAssociationArgs{
			PackageId:  example.ID(),
			DomainName: myDomain.DomainName,
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var myDomain = new Aws.OpenSearch.Domain("my_domain", new()
    {
        DomainName = "my-opensearch-domain",
        EngineVersion = "Elasticsearch_7.10",
        ClusterConfig = new Aws.OpenSearch.Inputs.DomainClusterConfigArgs
        {
            InstanceType = "r4.large.search",
        },
    });

    var example = new Aws.OpenSearch.Package("example", new()
    {
        PackageName = "example-txt",
        PackageSource = new Aws.OpenSearch.Inputs.PackagePackageSourceArgs
        {
            S3BucketName = myOpensearchPackages.Bucket,
            S3Key = exampleAwsS3Object.Key,
        },
        PackageType = "TXT-DICTIONARY",
    });

    var examplePackageAssociation = new Aws.OpenSearch.PackageAssociation("example", new()
    {
        PackageId = example.Id,
        DomainName = myDomain.DomainName,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.opensearch.Domain;
import com.pulumi.aws.opensearch.DomainArgs;
import com.pulumi.aws.opensearch.inputs.DomainClusterConfigArgs;
import com.pulumi.aws.opensearch.Package;
import com.pulumi.aws.opensearch.PackageArgs;
import com.pulumi.aws.opensearch.inputs.PackagePackageSourceArgs;
import com.pulumi.aws.opensearch.PackageAssociation;
import com.pulumi.aws.opensearch.PackageAssociationArgs;
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) {
        var myDomain = new Domain("myDomain", DomainArgs.builder()
            .domainName("my-opensearch-domain")
            .engineVersion("Elasticsearch_7.10")
            .clusterConfig(DomainClusterConfigArgs.builder()
                .instanceType("r4.large.search")
                .build())
            .build());

        var example = new Package("example", PackageArgs.builder()
            .packageName("example-txt")
            .packageSource(PackagePackageSourceArgs.builder()
                .s3BucketName(myOpensearchPackages.bucket())
                .s3Key(exampleAwsS3Object.key())
                .build())
            .packageType("TXT-DICTIONARY")
            .build());

        var examplePackageAssociation = new PackageAssociation("examplePackageAssociation", PackageAssociationArgs.builder()
            .packageId(example.id())
            .domainName(myDomain.domainName())
            .build());

    }
}
Copy
resources:
  myDomain:
    type: aws:opensearch:Domain
    name: my_domain
    properties:
      domainName: my-opensearch-domain
      engineVersion: Elasticsearch_7.10
      clusterConfig:
        instanceType: r4.large.search
  example:
    type: aws:opensearch:Package
    properties:
      packageName: example-txt
      packageSource:
        s3BucketName: ${myOpensearchPackages.bucket}
        s3Key: ${exampleAwsS3Object.key}
      packageType: TXT-DICTIONARY
  examplePackageAssociation:
    type: aws:opensearch:PackageAssociation
    name: example
    properties:
      packageId: ${example.id}
      domainName: ${myDomain.domainName}
Copy

Create PackageAssociation Resource

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

Constructor syntax

new PackageAssociation(name: string, args: PackageAssociationArgs, opts?: CustomResourceOptions);
@overload
def PackageAssociation(resource_name: str,
                       args: PackageAssociationArgs,
                       opts: Optional[ResourceOptions] = None)

@overload
def PackageAssociation(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       domain_name: Optional[str] = None,
                       package_id: Optional[str] = None)
func NewPackageAssociation(ctx *Context, name string, args PackageAssociationArgs, opts ...ResourceOption) (*PackageAssociation, error)
public PackageAssociation(string name, PackageAssociationArgs args, CustomResourceOptions? opts = null)
public PackageAssociation(String name, PackageAssociationArgs args)
public PackageAssociation(String name, PackageAssociationArgs args, CustomResourceOptions options)
type: aws:opensearch:PackageAssociation
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. PackageAssociationArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. PackageAssociationArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. PackageAssociationArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. PackageAssociationArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. PackageAssociationArgs
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 packageAssociationResource = new Aws.OpenSearch.PackageAssociation("packageAssociationResource", new()
{
    DomainName = "string",
    PackageId = "string",
});
Copy
example, err := opensearch.NewPackageAssociation(ctx, "packageAssociationResource", &opensearch.PackageAssociationArgs{
	DomainName: pulumi.String("string"),
	PackageId:  pulumi.String("string"),
})
Copy
var packageAssociationResource = new PackageAssociation("packageAssociationResource", PackageAssociationArgs.builder()
    .domainName("string")
    .packageId("string")
    .build());
Copy
package_association_resource = aws.opensearch.PackageAssociation("packageAssociationResource",
    domain_name="string",
    package_id="string")
Copy
const packageAssociationResource = new aws.opensearch.PackageAssociation("packageAssociationResource", {
    domainName: "string",
    packageId: "string",
});
Copy
type: aws:opensearch:PackageAssociation
properties:
    domainName: string
    packageId: string
Copy

PackageAssociation Resource Properties

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

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The PackageAssociation resource accepts the following input properties:

DomainName
This property is required.
Changes to this property will trigger replacement.
string
Name of the domain to associate the package with.
PackageId
This property is required.
Changes to this property will trigger replacement.
string
Internal ID of the package to associate with a domain.
DomainName
This property is required.
Changes to this property will trigger replacement.
string
Name of the domain to associate the package with.
PackageId
This property is required.
Changes to this property will trigger replacement.
string
Internal ID of the package to associate with a domain.
domainName
This property is required.
Changes to this property will trigger replacement.
String
Name of the domain to associate the package with.
packageId
This property is required.
Changes to this property will trigger replacement.
String
Internal ID of the package to associate with a domain.
domainName
This property is required.
Changes to this property will trigger replacement.
string
Name of the domain to associate the package with.
packageId
This property is required.
Changes to this property will trigger replacement.
string
Internal ID of the package to associate with a domain.
domain_name
This property is required.
Changes to this property will trigger replacement.
str
Name of the domain to associate the package with.
package_id
This property is required.
Changes to this property will trigger replacement.
str
Internal ID of the package to associate with a domain.
domainName
This property is required.
Changes to this property will trigger replacement.
String
Name of the domain to associate the package with.
packageId
This property is required.
Changes to this property will trigger replacement.
String
Internal ID of the package to associate with a domain.

Outputs

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

Id string
The provider-assigned unique ID for this managed resource.
ReferencePath string
Id string
The provider-assigned unique ID for this managed resource.
ReferencePath string
id String
The provider-assigned unique ID for this managed resource.
referencePath String
id string
The provider-assigned unique ID for this managed resource.
referencePath string
id str
The provider-assigned unique ID for this managed resource.
reference_path str
id String
The provider-assigned unique ID for this managed resource.
referencePath String

Look up Existing PackageAssociation Resource

Get an existing PackageAssociation 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?: PackageAssociationState, opts?: CustomResourceOptions): PackageAssociation
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        domain_name: Optional[str] = None,
        package_id: Optional[str] = None,
        reference_path: Optional[str] = None) -> PackageAssociation
func GetPackageAssociation(ctx *Context, name string, id IDInput, state *PackageAssociationState, opts ...ResourceOption) (*PackageAssociation, error)
public static PackageAssociation Get(string name, Input<string> id, PackageAssociationState? state, CustomResourceOptions? opts = null)
public static PackageAssociation get(String name, Output<String> id, PackageAssociationState state, CustomResourceOptions options)
resources:  _:    type: aws:opensearch:PackageAssociation    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
DomainName Changes to this property will trigger replacement. string
Name of the domain to associate the package with.
PackageId Changes to this property will trigger replacement. string
Internal ID of the package to associate with a domain.
ReferencePath string
DomainName Changes to this property will trigger replacement. string
Name of the domain to associate the package with.
PackageId Changes to this property will trigger replacement. string
Internal ID of the package to associate with a domain.
ReferencePath string
domainName Changes to this property will trigger replacement. String
Name of the domain to associate the package with.
packageId Changes to this property will trigger replacement. String
Internal ID of the package to associate with a domain.
referencePath String
domainName Changes to this property will trigger replacement. string
Name of the domain to associate the package with.
packageId Changes to this property will trigger replacement. string
Internal ID of the package to associate with a domain.
referencePath string
domain_name Changes to this property will trigger replacement. str
Name of the domain to associate the package with.
package_id Changes to this property will trigger replacement. str
Internal ID of the package to associate with a domain.
reference_path str
domainName Changes to this property will trigger replacement. String
Name of the domain to associate the package with.
packageId Changes to this property will trigger replacement. String
Internal ID of the package to associate with a domain.
referencePath String

Package Details

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