get Key
Use this data source to get detailed information about the specified KMS Key with flexible key id input. This can be useful to reference key alias without having to hard code the ARN as input.
Example Usage
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.kms.KmsFunctions;
import com.pulumi.aws.kms.inputs.GetKeyArgs;
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 byAlias = KmsFunctions.getKey(GetKeyArgs.builder()
.keyId("alias/my-key")
.build());
final var byId = KmsFunctions.getKey(GetKeyArgs.builder()
.keyId("1234abcd-12ab-34cd-56ef-1234567890ab")
.build());
final var byAliasArn = KmsFunctions.getKey(GetKeyArgs.builder()
.keyId("arn:aws:kms:us-east-1:111122223333:alias/my-key")
.build());
final var byKeyArn = KmsFunctions.getKey(GetKeyArgs.builder()
.keyId("arn:aws:kms:us-east-1:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab")
.build());
}
}
Content copied to clipboard
Return
A collection of values returned by getKey.
Parameters
argument
A collection of arguments for invoking getKey.
Return
A collection of values returned by getKey.
Parameters
grant Tokens
List of grant tokens
key Id
Key identifier which can be one of the following format:
Key ID. E.g:
1234abcd-12ab-34cd-56ef-1234567890ab
Key ARN. E.g.:
arn:aws:kms:us-east-1:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
Alias name. E.g.:
alias/my-key
Alias ARN: E.g.:
arn:aws:kms:us-east-1:111122223333:alias/my-key
See also
Return
A collection of values returned by getKey.
Parameters
argument
Builder for com.pulumi.aws.kms.kotlin.inputs.GetKeyPlainArgs.