Certificate

Creates and manages an AWS IoT certificate.

Example Usage

With CSR

using System.Collections.Generic;
using System.IO;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var cert = new Aws.Iot.Certificate("cert", new()
    {
        Csr = File.ReadAllText("/my/csr.pem"),
        Active = true,
    });

});
package main

import (
	"io/ioutil"

	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/iot"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func readFileOrPanic(path string) pulumi.StringPtrInput {
	data, err := ioutil.ReadFile(path)
	if err != nil {
		panic(err.Error())
	}
	return pulumi.String(string(data))
}

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := iot.NewCertificate(ctx, "cert", &iot.CertificateArgs{
			Csr:    readFileOrPanic("/my/csr.pem"),
			Active: pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.iot.Certificate;
import com.pulumi.aws.iot.CertificateArgs;
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 cert = new Certificate("cert", CertificateArgs.builder()        
            .csr(Files.readString(Paths.get("/my/csr.pem")))
            .active(true)
            .build());

    }
}
import pulumi
import pulumi_aws as aws

cert = aws.iot.Certificate("cert",
    csr=(lambda path: open(path).read())("/my/csr.pem"),
    active=True)
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
import * as fs from "fs";

const cert = new aws.iot.Certificate("cert", {
    csr: fs.readFileSync("/my/csr.pem"),
    active: true,
});
resources:
  cert:
    type: aws:iot:Certificate
    properties:
      csr:
        fn::readFile: /my/csr.pem
      active: true

Without CSR

using System.Collections.Generic;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var cert = new Aws.Iot.Certificate("cert", new()
    {
        Active = true,
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/iot"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := iot.NewCertificate(ctx, "cert", &iot.CertificateArgs{
			Active: pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.iot.Certificate;
import com.pulumi.aws.iot.CertificateArgs;
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 cert = new Certificate("cert", CertificateArgs.builder()        
            .active(true)
            .build());

    }
}
import pulumi
import pulumi_aws as aws

cert = aws.iot.Certificate("cert", active=True)
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const cert = new aws.iot.Certificate("cert", {active: true});
resources:
  cert:
    type: aws:iot:Certificate
    properties:
      active: true

From existing certificate without a CA

using System.Collections.Generic;
using System.IO;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var cert = new Aws.Iot.Certificate("cert", new()
    {
        CertificatePem = File.ReadAllText("/my/cert.pem"),
        Active = true,
    });

});
package main

import (
	"io/ioutil"

	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/iot"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func readFileOrPanic(path string) pulumi.StringPtrInput {
	data, err := ioutil.ReadFile(path)
	if err != nil {
		panic(err.Error())
	}
	return pulumi.String(string(data))
}

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := iot.NewCertificate(ctx, "cert", &iot.CertificateArgs{
			CertificatePem: readFileOrPanic("/my/cert.pem"),
			Active:         pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.iot.Certificate;
import com.pulumi.aws.iot.CertificateArgs;
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 cert = new Certificate("cert", CertificateArgs.builder()        
            .certificatePem(Files.readString(Paths.get("/my/cert.pem")))
            .active(true)
            .build());

    }
}
import pulumi
import pulumi_aws as aws

cert = aws.iot.Certificate("cert",
    certificate_pem=(lambda path: open(path).read())("/my/cert.pem"),
    active=True)
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
import * as fs from "fs";

const cert = new aws.iot.Certificate("cert", {
    certificatePem: fs.readFileSync("/my/cert.pem"),
    active: true,
});
resources:
  cert:
    type: aws:iot:Certificate
    properties:
      certificatePem:
        fn::readFile: /my/cert.pem
      active: true

Create Certificate Resource

new Certificate(name: string, args: CertificateArgs, opts?: CustomResourceOptions);
@overload
def Certificate(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                active: Optional[bool] = None,
                ca_pem: Optional[str] = None,
                certificate_pem: Optional[str] = None,
                csr: Optional[str] = None)
@overload
def Certificate(resource_name: str,
                args: CertificateArgs,
                opts: Optional[ResourceOptions] = None)
func NewCertificate(ctx *Context, name string, args CertificateArgs, opts ...ResourceOption) (*Certificate, error)
public Certificate(string name, CertificateArgs args, CustomResourceOptions? opts = null)
public Certificate(String name, CertificateArgs args)
public Certificate(String name, CertificateArgs args, CustomResourceOptions options)
type: aws:iot:Certificate
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

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

Certificate 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 Certificate resource accepts the following input properties:

Active bool

Boolean flag to indicate if the certificate should be active

CaPem string

The CA certificate for the certificate to be registered. If this is set, the CA needs to be registered with AWS IoT beforehand.

CertificatePem string

The certificate to be registered. If ca_pem is unspecified, review RegisterCertificateWithoutCA. If ca_pem is specified, review RegisterCertificate for more information on registering a certificate.

Csr string

The certificate signing request. Review CreateCertificateFromCsr for more information on generating a certificate from a certificate signing request (CSR). If none is specified both the certificate and keys will be generated, review CreateKeysAndCertificate for more information on generating keys and a certificate.

Active bool

Boolean flag to indicate if the certificate should be active

CaPem string

The CA certificate for the certificate to be registered. If this is set, the CA needs to be registered with AWS IoT beforehand.

CertificatePem string

The certificate to be registered. If ca_pem is unspecified, review RegisterCertificateWithoutCA. If ca_pem is specified, review RegisterCertificate for more information on registering a certificate.

Csr string

The certificate signing request. Review CreateCertificateFromCsr for more information on generating a certificate from a certificate signing request (CSR). If none is specified both the certificate and keys will be generated, review CreateKeysAndCertificate for more information on generating keys and a certificate.

active Boolean

Boolean flag to indicate if the certificate should be active

caPem String

The CA certificate for the certificate to be registered. If this is set, the CA needs to be registered with AWS IoT beforehand.

certificatePem String

The certificate to be registered. If ca_pem is unspecified, review RegisterCertificateWithoutCA. If ca_pem is specified, review RegisterCertificate for more information on registering a certificate.

csr String

The certificate signing request. Review CreateCertificateFromCsr for more information on generating a certificate from a certificate signing request (CSR). If none is specified both the certificate and keys will be generated, review CreateKeysAndCertificate for more information on generating keys and a certificate.

active boolean

Boolean flag to indicate if the certificate should be active

caPem string

The CA certificate for the certificate to be registered. If this is set, the CA needs to be registered with AWS IoT beforehand.

certificatePem string

The certificate to be registered. If ca_pem is unspecified, review RegisterCertificateWithoutCA. If ca_pem is specified, review RegisterCertificate for more information on registering a certificate.

csr string

The certificate signing request. Review CreateCertificateFromCsr for more information on generating a certificate from a certificate signing request (CSR). If none is specified both the certificate and keys will be generated, review CreateKeysAndCertificate for more information on generating keys and a certificate.

active bool

Boolean flag to indicate if the certificate should be active

ca_pem str

The CA certificate for the certificate to be registered. If this is set, the CA needs to be registered with AWS IoT beforehand.

certificate_pem str

The certificate to be registered. If ca_pem is unspecified, review RegisterCertificateWithoutCA. If ca_pem is specified, review RegisterCertificate for more information on registering a certificate.

csr str

The certificate signing request. Review CreateCertificateFromCsr for more information on generating a certificate from a certificate signing request (CSR). If none is specified both the certificate and keys will be generated, review CreateKeysAndCertificate for more information on generating keys and a certificate.

active Boolean

Boolean flag to indicate if the certificate should be active

caPem String

The CA certificate for the certificate to be registered. If this is set, the CA needs to be registered with AWS IoT beforehand.

certificatePem String

The certificate to be registered. If ca_pem is unspecified, review RegisterCertificateWithoutCA. If ca_pem is specified, review RegisterCertificate for more information on registering a certificate.

csr String

The certificate signing request. Review CreateCertificateFromCsr for more information on generating a certificate from a certificate signing request (CSR). If none is specified both the certificate and keys will be generated, review CreateKeysAndCertificate for more information on generating keys and a certificate.

Outputs

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

Arn string

The ARN of the created certificate.

Id string

The provider-assigned unique ID for this managed resource.

PrivateKey string

When neither CSR nor certificate is provided, the private key.

PublicKey string

When neither CSR nor certificate is provided, the public key.

Arn string

The ARN of the created certificate.

Id string

The provider-assigned unique ID for this managed resource.

PrivateKey string

When neither CSR nor certificate is provided, the private key.

PublicKey string

When neither CSR nor certificate is provided, the public key.

arn String

The ARN of the created certificate.

id String

The provider-assigned unique ID for this managed resource.

privateKey String

When neither CSR nor certificate is provided, the private key.

publicKey String

When neither CSR nor certificate is provided, the public key.

arn string

The ARN of the created certificate.

id string

The provider-assigned unique ID for this managed resource.

privateKey string

When neither CSR nor certificate is provided, the private key.

publicKey string

When neither CSR nor certificate is provided, the public key.

arn str

The ARN of the created certificate.

id str

The provider-assigned unique ID for this managed resource.

private_key str

When neither CSR nor certificate is provided, the private key.

public_key str

When neither CSR nor certificate is provided, the public key.

arn String

The ARN of the created certificate.

id String

The provider-assigned unique ID for this managed resource.

privateKey String

When neither CSR nor certificate is provided, the private key.

publicKey String

When neither CSR nor certificate is provided, the public key.

Look up Existing Certificate Resource

Get an existing Certificate 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?: CertificateState, opts?: CustomResourceOptions): Certificate
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        active: Optional[bool] = None,
        arn: Optional[str] = None,
        ca_pem: Optional[str] = None,
        certificate_pem: Optional[str] = None,
        csr: Optional[str] = None,
        private_key: Optional[str] = None,
        public_key: Optional[str] = None) -> Certificate
func GetCertificate(ctx *Context, name string, id IDInput, state *CertificateState, opts ...ResourceOption) (*Certificate, error)
public static Certificate Get(string name, Input<string> id, CertificateState? state, CustomResourceOptions? opts = null)
public static Certificate get(String name, Output<String> id, CertificateState 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:
Active bool

Boolean flag to indicate if the certificate should be active

Arn string

The ARN of the created certificate.

CaPem string

The CA certificate for the certificate to be registered. If this is set, the CA needs to be registered with AWS IoT beforehand.

CertificatePem string

The certificate to be registered. If ca_pem is unspecified, review RegisterCertificateWithoutCA. If ca_pem is specified, review RegisterCertificate for more information on registering a certificate.

Csr string

The certificate signing request. Review CreateCertificateFromCsr for more information on generating a certificate from a certificate signing request (CSR). If none is specified both the certificate and keys will be generated, review CreateKeysAndCertificate for more information on generating keys and a certificate.

PrivateKey string

When neither CSR nor certificate is provided, the private key.

PublicKey string

When neither CSR nor certificate is provided, the public key.

Active bool

Boolean flag to indicate if the certificate should be active

Arn string

The ARN of the created certificate.

CaPem string

The CA certificate for the certificate to be registered. If this is set, the CA needs to be registered with AWS IoT beforehand.

CertificatePem string

The certificate to be registered. If ca_pem is unspecified, review RegisterCertificateWithoutCA. If ca_pem is specified, review RegisterCertificate for more information on registering a certificate.

Csr string

The certificate signing request. Review CreateCertificateFromCsr for more information on generating a certificate from a certificate signing request (CSR). If none is specified both the certificate and keys will be generated, review CreateKeysAndCertificate for more information on generating keys and a certificate.

PrivateKey string

When neither CSR nor certificate is provided, the private key.

PublicKey string

When neither CSR nor certificate is provided, the public key.

active Boolean

Boolean flag to indicate if the certificate should be active

arn String

The ARN of the created certificate.

caPem String

The CA certificate for the certificate to be registered. If this is set, the CA needs to be registered with AWS IoT beforehand.

certificatePem String

The certificate to be registered. If ca_pem is unspecified, review RegisterCertificateWithoutCA. If ca_pem is specified, review RegisterCertificate for more information on registering a certificate.

csr String

The certificate signing request. Review CreateCertificateFromCsr for more information on generating a certificate from a certificate signing request (CSR). If none is specified both the certificate and keys will be generated, review CreateKeysAndCertificate for more information on generating keys and a certificate.

privateKey String

When neither CSR nor certificate is provided, the private key.

publicKey String

When neither CSR nor certificate is provided, the public key.

active boolean

Boolean flag to indicate if the certificate should be active

arn string

The ARN of the created certificate.

caPem string

The CA certificate for the certificate to be registered. If this is set, the CA needs to be registered with AWS IoT beforehand.

certificatePem string

The certificate to be registered. If ca_pem is unspecified, review RegisterCertificateWithoutCA. If ca_pem is specified, review RegisterCertificate for more information on registering a certificate.

csr string

The certificate signing request. Review CreateCertificateFromCsr for more information on generating a certificate from a certificate signing request (CSR). If none is specified both the certificate and keys will be generated, review CreateKeysAndCertificate for more information on generating keys and a certificate.

privateKey string

When neither CSR nor certificate is provided, the private key.

publicKey string

When neither CSR nor certificate is provided, the public key.

active bool

Boolean flag to indicate if the certificate should be active

arn str

The ARN of the created certificate.

ca_pem str

The CA certificate for the certificate to be registered. If this is set, the CA needs to be registered with AWS IoT beforehand.

certificate_pem str

The certificate to be registered. If ca_pem is unspecified, review RegisterCertificateWithoutCA. If ca_pem is specified, review RegisterCertificate for more information on registering a certificate.

csr str

The certificate signing request. Review CreateCertificateFromCsr for more information on generating a certificate from a certificate signing request (CSR). If none is specified both the certificate and keys will be generated, review CreateKeysAndCertificate for more information on generating keys and a certificate.

private_key str

When neither CSR nor certificate is provided, the private key.

public_key str

When neither CSR nor certificate is provided, the public key.

active Boolean

Boolean flag to indicate if the certificate should be active

arn String

The ARN of the created certificate.

caPem String

The CA certificate for the certificate to be registered. If this is set, the CA needs to be registered with AWS IoT beforehand.

certificatePem String

The certificate to be registered. If ca_pem is unspecified, review RegisterCertificateWithoutCA. If ca_pem is specified, review RegisterCertificate for more information on registering a certificate.

csr String

The certificate signing request. Review CreateCertificateFromCsr for more information on generating a certificate from a certificate signing request (CSR). If none is specified both the certificate and keys will be generated, review CreateKeysAndCertificate for more information on generating keys and a certificate.

privateKey String

When neither CSR nor certificate is provided, the private key.

publicKey String

When neither CSR nor certificate is provided, the public key.

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes

This Pulumi package is based on the aws Terraform Provider.