SshKey
Uploads an SSH public key and associates it with the specified IAM user.
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var userUser = new Aws.Iam.User("userUser", new Aws.Iam.UserArgs
{
Path = "/",
});
var userSshKey = new Aws.Iam.SshKey("userSshKey", new Aws.Iam.SshKeyArgs
{
Encoding = "SSH",
PublicKey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQz1x2cEikKDEY0aIj41qgxMCP/iteneqXSIFZBp5vizPvaoIR3Um9xK7PGoW8giupGn+EPuxIA4cDM4vzOqOkiMPhz5XK0whEjkVzTo4+S0puvDZuwIsdiW9mxhJc7tgBNL0cYlWSYVkz4G/fslNfRPW5mYAM49f4fhtxPb5ok4Q2Lg9dPKVHO/Bgeu5woMc7RY0p1ej6D4CKFE6lymSDJpW0YHX/wqE9+cfEauh7xZcG0q9t2ta6F6fmX0agvpFyZo8aFbXeUBr7osSCJNgvavWbM/06niWrOvYX2xwWdhXmXSrbX8ZbabVohBK41 mytest@mydomain.com",
Username = userUser.Name,
});
}
}
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/iam"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
userUser, err := iam.NewUser(ctx, "userUser", &iam.UserArgs{
Path: pulumi.String("/"),
})
if err != nil {
return err
}
_, err = iam.NewSshKey(ctx, "userSshKey", &iam.SshKeyArgs{
Encoding: pulumi.String("SSH"),
PublicKey: pulumi.String("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQz1x2cEikKDEY0aIj41qgxMCP/iteneqXSIFZBp5vizPvaoIR3Um9xK7PGoW8giupGn+EPuxIA4cDM4vzOqOkiMPhz5XK0whEjkVzTo4+S0puvDZuwIsdiW9mxhJc7tgBNL0cYlWSYVkz4G/fslNfRPW5mYAM49f4fhtxPb5ok4Q2Lg9dPKVHO/Bgeu5woMc7RY0p1ej6D4CKFE6lymSDJpW0YHX/wqE9+cfEauh7xZcG0q9t2ta6F6fmX0agvpFyZo8aFbXeUBr7osSCJNgvavWbM/06niWrOvYX2xwWdhXmXSrbX8ZbabVohBK41 mytest@mydomain.com"),
Username: userUser.Name,
})
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_aws as aws
user_user = aws.iam.User("userUser", path="/")
user_ssh_key = aws.iam.SshKey("userSshKey",
encoding="SSH",
public_key="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQz1x2cEikKDEY0aIj41qgxMCP/iteneqXSIFZBp5vizPvaoIR3Um9xK7PGoW8giupGn+EPuxIA4cDM4vzOqOkiMPhz5XK0whEjkVzTo4+S0puvDZuwIsdiW9mxhJc7tgBNL0cYlWSYVkz4G/fslNfRPW5mYAM49f4fhtxPb5ok4Q2Lg9dPKVHO/Bgeu5woMc7RY0p1ej6D4CKFE6lymSDJpW0YHX/wqE9+cfEauh7xZcG0q9t2ta6F6fmX0agvpFyZo8aFbXeUBr7osSCJNgvavWbM/06niWrOvYX2xwWdhXmXSrbX8ZbabVohBK41 mytest@mydomain.com",
username=user_user.name)import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const userUser = new aws.iam.User("user", {
path: "/",
});
const userSshKey = new aws.iam.SshKey("user", {
encoding: "SSH",
publicKey: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQz1x2cEikKDEY0aIj41qgxMCP/iteneqXSIFZBp5vizPvaoIR3Um9xK7PGoW8giupGn+EPuxIA4cDM4vzOqOkiMPhz5XK0whEjkVzTo4+S0puvDZuwIsdiW9mxhJc7tgBNL0cYlWSYVkz4G/fslNfRPW5mYAM49f4fhtxPb5ok4Q2Lg9dPKVHO/Bgeu5woMc7RY0p1ej6D4CKFE6lymSDJpW0YHX/wqE9+cfEauh7xZcG0q9t2ta6F6fmX0agvpFyZo8aFbXeUBr7osSCJNgvavWbM/06niWrOvYX2xwWdhXmXSrbX8ZbabVohBK41 mytest@mydomain.com",
username: userUser.name,
});Create a SshKey Resource
new SshKey(name: string, args: SshKeyArgs, opts?: CustomResourceOptions);def SshKey(resource_name, opts=None, encoding=None, public_key=None, status=None, username=None, __props__=None);func NewSshKey(ctx *Context, name string, args SshKeyArgs, opts ...ResourceOption) (*SshKey, error)public SshKey(string name, SshKeyArgs args, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args SshKeyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- opts ResourceOptions
- A bag of options that control this resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args SshKeyArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args SshKeyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
SshKey Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The SshKey resource accepts the following input properties:
- Encoding string
Specifies the public key encoding format to use in the response. To retrieve the public key in ssh-rsa format, use
SSH. To retrieve the public key in PEM format, usePEM.- Public
Key string The SSH public key. The public key must be encoded in ssh-rsa format or PEM format.
- Username string
The name of the IAM user to associate the SSH public key with.
- Status string
The status to assign to the SSH public key. Active means the key can be used for authentication with an AWS CodeCommit repository. Inactive means the key cannot be used. Default is
active.
- Encoding string
Specifies the public key encoding format to use in the response. To retrieve the public key in ssh-rsa format, use
SSH. To retrieve the public key in PEM format, usePEM.- Public
Key string The SSH public key. The public key must be encoded in ssh-rsa format or PEM format.
- Username string
The name of the IAM user to associate the SSH public key with.
- Status string
The status to assign to the SSH public key. Active means the key can be used for authentication with an AWS CodeCommit repository. Inactive means the key cannot be used. Default is
active.
- encoding string
Specifies the public key encoding format to use in the response. To retrieve the public key in ssh-rsa format, use
SSH. To retrieve the public key in PEM format, usePEM.- public
Key string The SSH public key. The public key must be encoded in ssh-rsa format or PEM format.
- username string
The name of the IAM user to associate the SSH public key with.
- status string
The status to assign to the SSH public key. Active means the key can be used for authentication with an AWS CodeCommit repository. Inactive means the key cannot be used. Default is
active.
- encoding str
Specifies the public key encoding format to use in the response. To retrieve the public key in ssh-rsa format, use
SSH. To retrieve the public key in PEM format, usePEM.- public_
key str The SSH public key. The public key must be encoded in ssh-rsa format or PEM format.
- username str
The name of the IAM user to associate the SSH public key with.
- status str
The status to assign to the SSH public key. Active means the key can be used for authentication with an AWS CodeCommit repository. Inactive means the key cannot be used. Default is
active.
Outputs
All input properties are implicitly available as output properties. Additionally, the SshKey resource produces the following output properties:
- Fingerprint string
The MD5 message digest of the SSH public key.
- Id string
- The provider-assigned unique ID for this managed resource.
- Ssh
Public stringKey Id The unique identifier for the SSH public key.
- Fingerprint string
The MD5 message digest of the SSH public key.
- Id string
- The provider-assigned unique ID for this managed resource.
- Ssh
Public stringKey Id The unique identifier for the SSH public key.
- fingerprint string
The MD5 message digest of the SSH public key.
- id string
- The provider-assigned unique ID for this managed resource.
- ssh
Public stringKey Id The unique identifier for the SSH public key.
- fingerprint str
The MD5 message digest of the SSH public key.
- id str
- The provider-assigned unique ID for this managed resource.
- ssh_
public_ strkey_ id The unique identifier for the SSH public key.
Look up an Existing SshKey Resource
Get an existing SshKey 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?: SshKeyState, opts?: CustomResourceOptions): SshKeystatic get(resource_name, id, opts=None, encoding=None, fingerprint=None, public_key=None, ssh_public_key_id=None, status=None, username=None, __props__=None);func GetSshKey(ctx *Context, name string, id IDInput, state *SshKeyState, opts ...ResourceOption) (*SshKey, error)public static SshKey Get(string name, Input<string> id, SshKeyState? 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:
- Encoding string
Specifies the public key encoding format to use in the response. To retrieve the public key in ssh-rsa format, use
SSH. To retrieve the public key in PEM format, usePEM.- Fingerprint string
The MD5 message digest of the SSH public key.
- Public
Key string The SSH public key. The public key must be encoded in ssh-rsa format or PEM format.
- Ssh
Public stringKey Id The unique identifier for the SSH public key.
- Status string
The status to assign to the SSH public key. Active means the key can be used for authentication with an AWS CodeCommit repository. Inactive means the key cannot be used. Default is
active.- Username string
The name of the IAM user to associate the SSH public key with.
- Encoding string
Specifies the public key encoding format to use in the response. To retrieve the public key in ssh-rsa format, use
SSH. To retrieve the public key in PEM format, usePEM.- Fingerprint string
The MD5 message digest of the SSH public key.
- Public
Key string The SSH public key. The public key must be encoded in ssh-rsa format or PEM format.
- Ssh
Public stringKey Id The unique identifier for the SSH public key.
- Status string
The status to assign to the SSH public key. Active means the key can be used for authentication with an AWS CodeCommit repository. Inactive means the key cannot be used. Default is
active.- Username string
The name of the IAM user to associate the SSH public key with.
- encoding string
Specifies the public key encoding format to use in the response. To retrieve the public key in ssh-rsa format, use
SSH. To retrieve the public key in PEM format, usePEM.- fingerprint string
The MD5 message digest of the SSH public key.
- public
Key string The SSH public key. The public key must be encoded in ssh-rsa format or PEM format.
- ssh
Public stringKey Id The unique identifier for the SSH public key.
- status string
The status to assign to the SSH public key. Active means the key can be used for authentication with an AWS CodeCommit repository. Inactive means the key cannot be used. Default is
active.- username string
The name of the IAM user to associate the SSH public key with.
- encoding str
Specifies the public key encoding format to use in the response. To retrieve the public key in ssh-rsa format, use
SSH. To retrieve the public key in PEM format, usePEM.- fingerprint str
The MD5 message digest of the SSH public key.
- public_
key str The SSH public key. The public key must be encoded in ssh-rsa format or PEM format.
- ssh_
public_ strkey_ id The unique identifier for the SSH public key.
- status str
The status to assign to the SSH public key. Active means the key can be used for authentication with an AWS CodeCommit repository. Inactive means the key cannot be used. Default is
active.- username str
The name of the IAM user to associate the SSH public key with.
Package Details
- Repository
- https://github.com/pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.