Documentation ¶
Index ¶
- func Alias_IsConstruct(x interface{}) *bool
- func Alias_IsOwnedResource(construct constructs.IConstruct) *bool
- func Alias_IsResource(construct constructs.IConstruct) *bool
- func CfnAlias_CFN_RESOURCE_TYPE_NAME() *string
- func CfnAlias_IsCfnElement(x interface{}) *bool
- func CfnAlias_IsCfnResource(x interface{}) *bool
- func CfnAlias_IsConstruct(x interface{}) *bool
- func CfnKey_CFN_RESOURCE_TYPE_NAME() *string
- func CfnKey_IsCfnElement(x interface{}) *bool
- func CfnKey_IsCfnResource(x interface{}) *bool
- func CfnKey_IsConstruct(x interface{}) *bool
- func CfnReplicaKey_CFN_RESOURCE_TYPE_NAME() *string
- func CfnReplicaKey_IsCfnElement(x interface{}) *bool
- func CfnReplicaKey_IsCfnResource(x interface{}) *bool
- func CfnReplicaKey_IsConstruct(x interface{}) *bool
- func Key_DEFAULT_DUMMY_KEY_ID() *string
- func Key_IsConstruct(x interface{}) *bool
- func Key_IsLookupDummy(key IKey) *bool
- func Key_IsOwnedResource(construct constructs.IConstruct) *bool
- func Key_IsResource(construct constructs.IConstruct) *bool
- func NewAlias_Override(a Alias, scope constructs.Construct, id *string, props *AliasProps)
- func NewCfnAlias_Override(c CfnAlias, scope constructs.Construct, id *string, props *CfnAliasProps)
- func NewCfnKey_Override(c CfnKey, scope constructs.Construct, id *string, props *CfnKeyProps)
- func NewCfnReplicaKey_Override(c CfnReplicaKey, scope constructs.Construct, id *string, ...)
- func NewKey_Override(k Key, scope constructs.Construct, id *string, props *KeyProps)
- func NewViaServicePrincipal_Override(v ViaServicePrincipal, serviceName *string, basePrincipal awsiam.IPrincipal)
- type Alias
- type AliasAttributes
- type AliasProps
- type CfnAlias
- type CfnAliasProps
- type CfnKey
- type CfnKeyProps
- type CfnReplicaKey
- type CfnReplicaKeyProps
- type IAlias
- type IKey
- type Key
- type KeyLookupOptions
- type KeyProps
- type KeySpec
- type KeyUsage
- type ViaServicePrincipal
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Alias_IsConstruct ¶
func Alias_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func Alias_IsOwnedResource ¶ added in v2.32.0
func Alias_IsOwnedResource(construct constructs.IConstruct) *bool
Returns true if the construct was created by CDK, and false otherwise.
func Alias_IsResource ¶
func Alias_IsResource(construct constructs.IConstruct) *bool
Check whether the given construct is a Resource.
func CfnAlias_CFN_RESOURCE_TYPE_NAME ¶
func CfnAlias_CFN_RESOURCE_TYPE_NAME() *string
func CfnAlias_IsCfnElement ¶
func CfnAlias_IsCfnElement(x interface{}) *bool
Returns `true` if a construct is a stack element (i.e. part of the synthesized cloudformation template).
Uses duck-typing instead of `instanceof` to allow stack elements from different versions of this library to be included in the same stack.
Returns: The construct as a stack element or undefined if it is not a stack element.
func CfnAlias_IsCfnResource ¶
func CfnAlias_IsCfnResource(x interface{}) *bool
Check whether the given object is a CfnResource.
func CfnAlias_IsConstruct ¶
func CfnAlias_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func CfnKey_CFN_RESOURCE_TYPE_NAME ¶
func CfnKey_CFN_RESOURCE_TYPE_NAME() *string
func CfnKey_IsCfnElement ¶
func CfnKey_IsCfnElement(x interface{}) *bool
Returns `true` if a construct is a stack element (i.e. part of the synthesized cloudformation template).
Uses duck-typing instead of `instanceof` to allow stack elements from different versions of this library to be included in the same stack.
Returns: The construct as a stack element or undefined if it is not a stack element.
func CfnKey_IsCfnResource ¶
func CfnKey_IsCfnResource(x interface{}) *bool
Check whether the given object is a CfnResource.
func CfnKey_IsConstruct ¶
func CfnKey_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func CfnReplicaKey_CFN_RESOURCE_TYPE_NAME ¶
func CfnReplicaKey_CFN_RESOURCE_TYPE_NAME() *string
func CfnReplicaKey_IsCfnElement ¶
func CfnReplicaKey_IsCfnElement(x interface{}) *bool
Returns `true` if a construct is a stack element (i.e. part of the synthesized cloudformation template).
Uses duck-typing instead of `instanceof` to allow stack elements from different versions of this library to be included in the same stack.
Returns: The construct as a stack element or undefined if it is not a stack element.
func CfnReplicaKey_IsCfnResource ¶
func CfnReplicaKey_IsCfnResource(x interface{}) *bool
Check whether the given object is a CfnResource.
func CfnReplicaKey_IsConstruct ¶
func CfnReplicaKey_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func Key_DEFAULT_DUMMY_KEY_ID ¶ added in v2.163.0
func Key_DEFAULT_DUMMY_KEY_ID() *string
func Key_IsConstruct ¶
func Key_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func Key_IsLookupDummy ¶ added in v2.163.0
Checks if the key returned by the `Key.fromLookup()` method is a dummy key, i.e., a key that was not found.
This method can only be used if the `returnDummyKeyOnMissing` option is set to `true` in the `options` for the `Key.fromLookup()` method.
func Key_IsOwnedResource ¶ added in v2.32.0
func Key_IsOwnedResource(construct constructs.IConstruct) *bool
Returns true if the construct was created by CDK, and false otherwise.
func Key_IsResource ¶
func Key_IsResource(construct constructs.IConstruct) *bool
Check whether the given construct is a Resource.
func NewAlias_Override ¶
func NewAlias_Override(a Alias, scope constructs.Construct, id *string, props *AliasProps)
func NewCfnAlias_Override ¶
func NewCfnAlias_Override(c CfnAlias, scope constructs.Construct, id *string, props *CfnAliasProps)
func NewCfnKey_Override ¶
func NewCfnKey_Override(c CfnKey, scope constructs.Construct, id *string, props *CfnKeyProps)
func NewCfnReplicaKey_Override ¶
func NewCfnReplicaKey_Override(c CfnReplicaKey, scope constructs.Construct, id *string, props *CfnReplicaKeyProps)
func NewKey_Override ¶
func NewViaServicePrincipal_Override ¶
func NewViaServicePrincipal_Override(v ViaServicePrincipal, serviceName *string, basePrincipal awsiam.IPrincipal)
Types ¶
type Alias ¶
type Alias interface { awscdk.Resource IAlias // The ARN of the alias. AliasArn() *string // The name of the alias. AliasName() *string // The Key to which the Alias refers. AliasTargetKey() IKey // The environment this resource belongs to. // // For resources that are created and managed by the CDK // (generally, those created by creating new class instances like Role, Bucket, etc.), // this is always the same as the environment of the stack they belong to; // however, for imported resources // (those obtained from static methods like fromRoleArn, fromBucketName, etc.), // that might be different than the stack they were imported into. Env() *awscdk.ResourceEnvironment // The ARN of the alias. // Deprecated: use `aliasArn` instead. KeyArn() *string // The ID of the key (the part that looks something like: 1234abcd-12ab-34cd-56ef-1234567890ab). KeyId() *string // The tree node. Node() constructs.Node // Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource. // // This value will resolve to one of the following: // - a concrete value (e.g. `"my-awesome-bucket"`) // - `undefined`, when a name should be generated by CloudFormation // - a concrete name generated automatically during synthesis, in // cross-environment scenarios. PhysicalName() *string // The stack in which this resource is defined. Stack() awscdk.Stack // Defines a new alias for the key. AddAlias(alias *string) Alias // Adds a statement to the KMS key resource policy. AddToResourcePolicy(statement awsiam.PolicyStatement, allowNoOp *bool) *awsiam.AddToResourcePolicyResult // Apply the given removal policy to this resource. // // The Removal Policy controls what happens to this resource when it stops // being managed by CloudFormation, either because you've removed it from the // CDK application or because you've made a change that requires the resource // to be replaced. // // The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS // account for data recovery and cleanup later (`RemovalPolicy.RETAIN`). ApplyRemovalPolicy(policy awscdk.RemovalPolicy) GeneratePhysicalName() *string // Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. `bucket.bucketArn`). // // Normally, this token will resolve to `arnAttr`, but if the resource is // referenced across environments, `arnComponents` will be used to synthesize // a concrete ARN with the resource's physical name. Make sure to reference // `this.physicalName` in `arnComponents`. GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string // Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. `bucket.bucketName`). // // Normally, this token will resolve to `nameAttr`, but if the resource is // referenced across environments, it will be resolved to `this.physicalName`, // which will be a concrete name. GetResourceNameAttribute(nameAttr *string) *string // Grant the indicated permissions on this key to the given principal. Grant(grantee awsiam.IGrantable, actions ...*string) awsiam.Grant // Grant decryption permissions using this key to the given principal. GrantDecrypt(grantee awsiam.IGrantable) awsiam.Grant // Grant encryption permissions using this key to the given principal. GrantEncrypt(grantee awsiam.IGrantable) awsiam.Grant // Grant encryption and decryption permissions using this key to the given principal. GrantEncryptDecrypt(grantee awsiam.IGrantable) awsiam.Grant // Grant permissions to generating MACs to the given principal. GrantGenerateMac(grantee awsiam.IGrantable) awsiam.Grant // Grant permissions to verifying MACs to the given principal. GrantVerifyMac(grantee awsiam.IGrantable) awsiam.Grant // Returns a string representation of this construct. ToString() *string }
Defines a display name for a customer master key (CMK) in AWS Key Management Service (AWS KMS).
Using an alias to refer to a key can help you simplify key management. For example, when rotating keys, you can just update the alias mapping instead of tracking and changing key IDs. For more information, see Working with Aliases in the AWS Key Management Service Developer Guide.
You can also add an alias for a key by calling `key.addAlias(alias)`.
Example:
// Passing an encrypted replication bucket created in a different stack. app := awscdk.NewApp() replicationStack := awscdk.Newstack(app, jsii.String("ReplicationStack"), &StackProps{ Env: &Environment{ Region: jsii.String("us-west-1"), }, }) key := kms.NewKey(replicationStack, jsii.String("ReplicationKey")) alias := kms.NewAlias(replicationStack, jsii.String("ReplicationAlias"), &AliasProps{ // aliasName is required AliasName: awscdk.PhysicalName_GENERATE_IF_NEEDED(), TargetKey: key, }) replicationBucket := s3.NewBucket(replicationStack, jsii.String("ReplicationBucket"), &BucketProps{ BucketName: awscdk.PhysicalName_GENERATE_IF_NEEDED(), EncryptionKey: alias, })
func NewAlias ¶
func NewAlias(scope constructs.Construct, id *string, props *AliasProps) Alias
type AliasAttributes ¶
type AliasAttributes struct { // Specifies the alias name. // // This value must begin with alias/ followed by a name (i.e. alias/ExampleAlias) AliasName *string `field:"required" json:"aliasName" yaml:"aliasName"` // The customer master key (CMK) to which the Alias refers. AliasTargetKey IKey `field:"required" json:"aliasTargetKey" yaml:"aliasTargetKey"` }
Properties of a reference to an existing KMS Alias.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" var key key aliasAttributes := &AliasAttributes{ AliasName: jsii.String("aliasName"), AliasTargetKey: key, }
type AliasProps ¶
type AliasProps struct { // The name of the alias. // // The name must start with alias followed by a // forward slash, such as alias/. You can't specify aliases that begin with // alias/AWS. These aliases are reserved. AliasName *string `field:"required" json:"aliasName" yaml:"aliasName"` // The ID of the key for which you are creating the alias. // // Specify the key's // globally unique identifier or Amazon Resource Name (ARN). You can't // specify another alias. TargetKey IKey `field:"required" json:"targetKey" yaml:"targetKey"` // Policy to apply when the alias is removed from this stack. // Default: - The alias will be deleted. // RemovalPolicy awscdk.RemovalPolicy `field:"optional" json:"removalPolicy" yaml:"removalPolicy"` }
Construction properties for a KMS Key Alias object.
Example:
// Passing an encrypted replication bucket created in a different stack. app := awscdk.NewApp() replicationStack := awscdk.Newstack(app, jsii.String("ReplicationStack"), &StackProps{ Env: &Environment{ Region: jsii.String("us-west-1"), }, }) key := kms.NewKey(replicationStack, jsii.String("ReplicationKey")) alias := kms.NewAlias(replicationStack, jsii.String("ReplicationAlias"), &AliasProps{ // aliasName is required AliasName: awscdk.PhysicalName_GENERATE_IF_NEEDED(), TargetKey: key, }) replicationBucket := s3.NewBucket(replicationStack, jsii.String("ReplicationBucket"), &BucketProps{ BucketName: awscdk.PhysicalName_GENERATE_IF_NEEDED(), EncryptionKey: alias, })
type CfnAlias ¶
type CfnAlias interface { awscdk.CfnResource awscdk.IInspectable // Specifies the alias name. // // This value must begin with `alias/` followed by a name, such as `alias/ExampleAlias` . AliasName() *string SetAliasName(val *string) // Options for this resource, such as condition, update policy etc. CfnOptions() awscdk.ICfnResourceOptions CfnProperties() *map[string]interface{} // AWS resource type. CfnResourceType() *string // Returns: the stack trace of the point where this Resource was created from, sourced // from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most // node +internal+ entries filtered. CreationStack() *[]*string // The logical ID for this CloudFormation stack element. // // The logical ID of the element // is calculated from the path of the resource node in the construct tree. // // To override this value, use `overrideLogicalId(newLogicalId)`. // // Returns: the logical ID as a stringified token. This value will only get // resolved during synthesis. LogicalId() *string // The tree node. Node() constructs.Node // Return a string that will be resolved to a CloudFormation `{ Ref }` for this element. // // If, by any chance, the intrinsic reference of a resource is not a string, you could // coerce it to an IResolvable through `Lazy.any({ produce: resource.ref })`. Ref() *string // The stack in which this element is defined. // // CfnElements must be defined within a stack scope (directly or indirectly). Stack() awscdk.Stack // Associates the alias with the specified [customer managed key](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#customer-cmk) . The KMS key must be in the same AWS account and Region. TargetKeyId() *string SetTargetKeyId(val *string) // Deprecated. // Deprecated: use `updatedProperties` // // Return properties modified after initiation // // Resources that expose mutable properties should override this function to // collect and return the properties object for this resource. UpdatedProperites() *map[string]interface{} // Return properties modified after initiation. // // Resources that expose mutable properties should override this function to // collect and return the properties object for this resource. UpdatedProperties() *map[string]interface{} // Syntactic sugar for `addOverride(path, undefined)`. AddDeletionOverride(path *string) // Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned. // // This can be used for resources across stacks (or nested stack) boundaries // and the dependency will automatically be transferred to the relevant scope. AddDependency(target awscdk.CfnResource) // Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned. // Deprecated: use addDependency. AddDependsOn(target awscdk.CfnResource) // Add a value to the CloudFormation Resource Metadata. // See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html // // Note that this is a different set of metadata from CDK node metadata; this // metadata ends up in the stack template under the resource, whereas CDK // node metadata ends up in the Cloud Assembly. // AddMetadata(key *string, value interface{}) // Adds an override to the synthesized CloudFormation resource. // // To add a // property override, either use `addPropertyOverride` or prefix `path` with // "Properties." (i.e. `Properties.TopicName`). // // If the override is nested, separate each nested level using a dot (.) in the path parameter. // If there is an array as part of the nesting, specify the index in the path. // // To include a literal `.` in the property name, prefix with a `\`. In most // programming languages you will need to write this as `"\\."` because the // `\` itself will need to be escaped. // // For example, // “`typescript // cfnResource.addOverride('Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes', ['myattribute']); // cfnResource.addOverride('Properties.GlobalSecondaryIndexes.1.ProjectionType', 'INCLUDE'); // “` // would add the overrides // “`json // "Properties": { // "GlobalSecondaryIndexes": [ // { // "Projection": { // "NonKeyAttributes": [ "myattribute" ] // ... // } // ... // }, // { // "ProjectionType": "INCLUDE" // ... // }, // ] // ... // } // “` // // The `value` argument to `addOverride` will not be processed or translated // in any way. Pass raw JSON values in here with the correct capitalization // for CloudFormation. If you pass CDK classes or structs, they will be // rendered with lowercased key names, and CloudFormation will reject the // template. AddOverride(path *string, value interface{}) // Adds an override that deletes the value of a property from the resource definition. AddPropertyDeletionOverride(propertyPath *string) // Adds an override to a resource property. // // Syntactic sugar for `addOverride("Properties.<...>", value)`. AddPropertyOverride(propertyPath *string, value interface{}) // Sets the deletion policy of the resource based on the removal policy specified. // // The Removal Policy controls what happens to this resource when it stops // being managed by CloudFormation, either because you've removed it from the // CDK application or because you've made a change that requires the resource // to be replaced. // // The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS // account for data recovery and cleanup later (`RemovalPolicy.RETAIN`). In some // cases, a snapshot can be taken of the resource prior to deletion // (`RemovalPolicy.SNAPSHOT`). A list of resources that support this policy // can be found in the following link:. // See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html#aws-attribute-deletionpolicy-options // ApplyRemovalPolicy(policy awscdk.RemovalPolicy, options *awscdk.RemovalPolicyOptions) // Returns a token for an runtime attribute of this resource. // // Ideally, use generated attribute accessors (e.g. `resource.arn`), but this can be used for future compatibility // in case there is no generated attribute. GetAtt(attributeName *string, typeHint awscdk.ResolutionTypeHint) awscdk.Reference // Retrieve a value value from the CloudFormation Resource Metadata. // See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html // // Note that this is a different set of metadata from CDK node metadata; this // metadata ends up in the stack template under the resource, whereas CDK // node metadata ends up in the Cloud Assembly. // GetMetadata(key *string) interface{} // Examines the CloudFormation resource and discloses attributes. Inspect(inspector awscdk.TreeInspector) // Retrieves an array of resources this resource depends on. // // This assembles dependencies on resources across stacks (including nested stacks) // automatically. ObtainDependencies() *[]interface{} // Get a shallow copy of dependencies between this resource and other resources in the same stack. ObtainResourceDependencies() *[]awscdk.CfnResource // Overrides the auto-generated logical ID with a specific ID. OverrideLogicalId(newLogicalId *string) // Indicates that this resource no longer depends on another resource. // // This can be used for resources across stacks (including nested stacks) // and the dependency will automatically be removed from the relevant scope. RemoveDependency(target awscdk.CfnResource) RenderProperties(props *map[string]interface{}) *map[string]interface{} // Replaces one dependency with another. ReplaceDependency(target awscdk.CfnResource, newTarget awscdk.CfnResource) // Can be overridden by subclasses to determine if this resource will be rendered into the cloudformation template. // // Returns: `true` if the resource should be included or `false` is the resource // should be omitted. ShouldSynthesize() *bool // Returns a string representation of this construct. // // Returns: a string representation of this resource. ToString() *string ValidateProperties(_properties interface{}) }
The `AWS::KMS::Alias` resource specifies a display name for a [KMS key](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#kms_keys) . You can use an alias to identify a KMS key in the AWS KMS console, in the [DescribeKey](https://docs.aws.amazon.com/kms/latest/APIReference/API_DescribeKey.html) operation, and in [cryptographic operations](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#cryptographic-operations) , such as [Decrypt](https://docs.aws.amazon.com/kms/latest/APIReference/API_Decrypt.html) and [GenerateDataKey](https://docs.aws.amazon.com/kms/latest/APIReference/API_GenerateDataKey.html) .
> Adding, deleting, or updating an alias can allow or deny permission to the KMS key. For details, see [ABAC for AWS KMS](https://docs.aws.amazon.com/kms/latest/developerguide/abac.html) in the *AWS Key Management Service Developer Guide* .
Using an alias to refer to a KMS key can help you simplify key management. For example, an alias in your code can be associated with different KMS keys in different AWS Regions . For more information, see [Using aliases](https://docs.aws.amazon.com/kms/latest/developerguide/kms-alias.html) in the *AWS Key Management Service Developer Guide* .
When specifying an alias, observe the following rules.
- Each alias is associated with one KMS key, but multiple aliases can be associated with the same KMS key. - The alias and its associated KMS key must be in the same AWS account and Region. - The alias name must be unique in the AWS account and Region. However, you can create aliases with the same name in different AWS Regions . For example, you can have an `alias/projectKey` in multiple Regions, each of which is associated with a KMS key in its Region. - Each alias name must begin with `alias/` followed by a name, such as `alias/exampleKey` . The alias name can contain only alphanumeric characters, forward slashes (/), underscores (_), and dashes (-). Alias names cannot begin with `alias/aws/` . That alias name prefix is reserved for [AWS managed keys](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk) .
*Regions*
AWS KMS CloudFormation resources are available in all AWS Regions in which AWS KMS and AWS CloudFormation are supported.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" cfnAlias := awscdk.Aws_kms.NewCfnAlias(this, jsii.String("MyCfnAlias"), &CfnAliasProps{ AliasName: jsii.String("aliasName"), TargetKeyId: jsii.String("targetKeyId"), })
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kms-alias.html
func NewCfnAlias ¶
func NewCfnAlias(scope constructs.Construct, id *string, props *CfnAliasProps) CfnAlias
type CfnAliasProps ¶
type CfnAliasProps struct { // Specifies the alias name. This value must begin with `alias/` followed by a name, such as `alias/ExampleAlias` . // // > If you change the value of the `AliasName` property, the existing alias is deleted and a new alias is created for the specified KMS key. This change can disrupt applications that use the alias. It can also allow or deny access to a KMS key affected by attribute-based access control (ABAC). // // The alias must be string of 1-256 characters. It can contain only alphanumeric characters, forward slashes (/), underscores (_), and dashes (-). The alias name cannot begin with `alias/aws/` . The `alias/aws/` prefix is reserved for [AWS managed keys](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk) . // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kms-alias.html#cfn-kms-alias-aliasname // AliasName *string `field:"required" json:"aliasName" yaml:"aliasName"` // Associates the alias with the specified [customer managed key](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#customer-cmk) . The KMS key must be in the same AWS account and Region. // // A valid key ID is required. If you supply a null or empty string value, this operation returns an error. // // For help finding the key ID and ARN, see [Finding the key ID and ARN](https://docs.aws.amazon.com/kms/latest/developerguide/viewing-keys.html#find-cmk-id-arn) in the *AWS Key Management Service Developer Guide* . // // Specify the key ID or the key ARN of the KMS key. // // For example: // // - Key ID: `1234abcd-12ab-34cd-56ef-1234567890ab` // - Key ARN: `arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab` // // To get the key ID and key ARN for a KMS key, use [ListKeys](https://docs.aws.amazon.com/kms/latest/APIReference/API_ListKeys.html) or [DescribeKey](https://docs.aws.amazon.com/kms/latest/APIReference/API_DescribeKey.html) . // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kms-alias.html#cfn-kms-alias-targetkeyid // TargetKeyId *string `field:"required" json:"targetKeyId" yaml:"targetKeyId"` }
Properties for defining a `CfnAlias`.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" cfnAliasProps := &CfnAliasProps{ AliasName: jsii.String("aliasName"), TargetKeyId: jsii.String("targetKeyId"), }
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kms-alias.html
type CfnKey ¶
type CfnKey interface { awscdk.CfnResource awscdk.IInspectable awscdk.ITaggable // The Amazon Resource Name (ARN) of the KMS key, such as `arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab` . // // For information about the key ARN of a KMS key, see [Key ARN](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id-key-ARN) in the *AWS Key Management Service Developer Guide* . AttrArn() *string // The key ID of the KMS key, such as `1234abcd-12ab-34cd-56ef-1234567890ab` . // // For information about the key ID of a KMS key, see [Key ID](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id-key-id) in the *AWS Key Management Service Developer Guide* . AttrKeyId() *string // Skips ("bypasses") the key policy lockout safety check. // // The default value is false. BypassPolicyLockoutSafetyCheck() interface{} SetBypassPolicyLockoutSafetyCheck(val interface{}) // Options for this resource, such as condition, update policy etc. CfnOptions() awscdk.ICfnResourceOptions CfnProperties() *map[string]interface{} // AWS resource type. CfnResourceType() *string // Returns: the stack trace of the point where this Resource was created from, sourced // from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most // node +internal+ entries filtered. CreationStack() *[]*string // A description of the KMS key. Description() *string SetDescription(val *string) // Specifies whether the KMS key is enabled. // // Disabled KMS keys cannot be used in cryptographic operations. Enabled() interface{} SetEnabled(val interface{}) // Enables automatic rotation of the key material for the specified KMS key. EnableKeyRotation() interface{} SetEnableKeyRotation(val interface{}) // The key policy to attach to the KMS key. KeyPolicy() interface{} SetKeyPolicy(val interface{}) // Specifies the type of KMS key to create. KeySpec() *string SetKeySpec(val *string) // Determines the [cryptographic operations](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#cryptographic-operations) for which you can use the KMS key. The default value is `ENCRYPT_DECRYPT` . This property is required for asymmetric KMS keys and HMAC KMS keys. You can't change the `KeyUsage` value after the KMS key is created. KeyUsage() *string SetKeyUsage(val *string) // The logical ID for this CloudFormation stack element. // // The logical ID of the element // is calculated from the path of the resource node in the construct tree. // // To override this value, use `overrideLogicalId(newLogicalId)`. // // Returns: the logical ID as a stringified token. This value will only get // resolved during synthesis. LogicalId() *string // Creates a multi-Region primary key that you can replicate in other AWS Regions . MultiRegion() interface{} SetMultiRegion(val interface{}) // The tree node. Node() constructs.Node // The source of the key material for the KMS key. Origin() *string SetOrigin(val *string) // Specifies the number of days in the waiting period before AWS KMS deletes a KMS key that has been removed from a CloudFormation stack. PendingWindowInDays() *float64 SetPendingWindowInDays(val *float64) // Return a string that will be resolved to a CloudFormation `{ Ref }` for this element. // // If, by any chance, the intrinsic reference of a resource is not a string, you could // coerce it to an IResolvable through `Lazy.any({ produce: resource.ref })`. Ref() *string // Specifies a custom period of time between each rotation date. RotationPeriodInDays() *float64 SetRotationPeriodInDays(val *float64) // The stack in which this element is defined. // // CfnElements must be defined within a stack scope (directly or indirectly). Stack() awscdk.Stack // Tag Manager which manages the tags for this resource. Tags() awscdk.TagManager // Assigns one or more tags to the replica key. TagsRaw() *[]*awscdk.CfnTag SetTagsRaw(val *[]*awscdk.CfnTag) // Deprecated. // Deprecated: use `updatedProperties` // // Return properties modified after initiation // // Resources that expose mutable properties should override this function to // collect and return the properties object for this resource. UpdatedProperites() *map[string]interface{} // Return properties modified after initiation. // // Resources that expose mutable properties should override this function to // collect and return the properties object for this resource. UpdatedProperties() *map[string]interface{} // Syntactic sugar for `addOverride(path, undefined)`. AddDeletionOverride(path *string) // Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned. // // This can be used for resources across stacks (or nested stack) boundaries // and the dependency will automatically be transferred to the relevant scope. AddDependency(target awscdk.CfnResource) // Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned. // Deprecated: use addDependency. AddDependsOn(target awscdk.CfnResource) // Add a value to the CloudFormation Resource Metadata. // See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html // // Note that this is a different set of metadata from CDK node metadata; this // metadata ends up in the stack template under the resource, whereas CDK // node metadata ends up in the Cloud Assembly. // AddMetadata(key *string, value interface{}) // Adds an override to the synthesized CloudFormation resource. // // To add a // property override, either use `addPropertyOverride` or prefix `path` with // "Properties." (i.e. `Properties.TopicName`). // // If the override is nested, separate each nested level using a dot (.) in the path parameter. // If there is an array as part of the nesting, specify the index in the path. // // To include a literal `.` in the property name, prefix with a `\`. In most // programming languages you will need to write this as `"\\."` because the // `\` itself will need to be escaped. // // For example, // “`typescript // cfnResource.addOverride('Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes', ['myattribute']); // cfnResource.addOverride('Properties.GlobalSecondaryIndexes.1.ProjectionType', 'INCLUDE'); // “` // would add the overrides // “`json // "Properties": { // "GlobalSecondaryIndexes": [ // { // "Projection": { // "NonKeyAttributes": [ "myattribute" ] // ... // } // ... // }, // { // "ProjectionType": "INCLUDE" // ... // }, // ] // ... // } // “` // // The `value` argument to `addOverride` will not be processed or translated // in any way. Pass raw JSON values in here with the correct capitalization // for CloudFormation. If you pass CDK classes or structs, they will be // rendered with lowercased key names, and CloudFormation will reject the // template. AddOverride(path *string, value interface{}) // Adds an override that deletes the value of a property from the resource definition. AddPropertyDeletionOverride(propertyPath *string) // Adds an override to a resource property. // // Syntactic sugar for `addOverride("Properties.<...>", value)`. AddPropertyOverride(propertyPath *string, value interface{}) // Sets the deletion policy of the resource based on the removal policy specified. // // The Removal Policy controls what happens to this resource when it stops // being managed by CloudFormation, either because you've removed it from the // CDK application or because you've made a change that requires the resource // to be replaced. // // The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS // account for data recovery and cleanup later (`RemovalPolicy.RETAIN`). In some // cases, a snapshot can be taken of the resource prior to deletion // (`RemovalPolicy.SNAPSHOT`). A list of resources that support this policy // can be found in the following link:. // See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html#aws-attribute-deletionpolicy-options // ApplyRemovalPolicy(policy awscdk.RemovalPolicy, options *awscdk.RemovalPolicyOptions) // Returns a token for an runtime attribute of this resource. // // Ideally, use generated attribute accessors (e.g. `resource.arn`), but this can be used for future compatibility // in case there is no generated attribute. GetAtt(attributeName *string, typeHint awscdk.ResolutionTypeHint) awscdk.Reference // Retrieve a value value from the CloudFormation Resource Metadata. // See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html // // Note that this is a different set of metadata from CDK node metadata; this // metadata ends up in the stack template under the resource, whereas CDK // node metadata ends up in the Cloud Assembly. // GetMetadata(key *string) interface{} // Examines the CloudFormation resource and discloses attributes. Inspect(inspector awscdk.TreeInspector) // Retrieves an array of resources this resource depends on. // // This assembles dependencies on resources across stacks (including nested stacks) // automatically. ObtainDependencies() *[]interface{} // Get a shallow copy of dependencies between this resource and other resources in the same stack. ObtainResourceDependencies() *[]awscdk.CfnResource // Overrides the auto-generated logical ID with a specific ID. OverrideLogicalId(newLogicalId *string) // Indicates that this resource no longer depends on another resource. // // This can be used for resources across stacks (including nested stacks) // and the dependency will automatically be removed from the relevant scope. RemoveDependency(target awscdk.CfnResource) RenderProperties(props *map[string]interface{}) *map[string]interface{} // Replaces one dependency with another. ReplaceDependency(target awscdk.CfnResource, newTarget awscdk.CfnResource) // Can be overridden by subclasses to determine if this resource will be rendered into the cloudformation template. // // Returns: `true` if the resource should be included or `false` is the resource // should be omitted. ShouldSynthesize() *bool // Returns a string representation of this construct. // // Returns: a string representation of this resource. ToString() *string ValidateProperties(_properties interface{}) }
The `AWS::KMS::Key` resource specifies an [KMS key](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#kms_keys) in AWS Key Management Service . You can use this resource to create symmetric encryption KMS keys, asymmetric KMS keys for encryption or signing, and symmetric HMAC KMS keys. You can use `AWS::KMS::Key` to create [multi-Region primary keys](https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html#mrk-primary-key) of all supported types. To replicate a multi-Region key, use the `AWS::KMS::ReplicaKey` resource.
> If you change the value of the `KeySpec` , `KeyUsage` , `Origin` , or `MultiRegion` properties of an existing KMS key, the update request fails, regardless of the value of the [`UpdateReplacePolicy` attribute](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-updatereplacepolicy.html) . This prevents you from accidentally deleting a KMS key by changing any of its immutable property values. > AWS KMS replaced the term *customer master key (CMK)* with *AWS KMS key* and *KMS key* . The concept has not changed. To prevent breaking changes, AWS KMS is keeping some variations of this term.
You can use symmetric encryption KMS keys to encrypt and decrypt small amounts of data, but they are more commonly used to generate data keys and data key pairs. You can also use a symmetric encryption KMS key to encrypt data stored in AWS services that are [integrated with AWS KMS](https://docs.aws.amazon.com//kms/features/#AWS_Service_Integration) . For more information, see [Symmetric encryption KMS keys](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#symmetric-cmks) in the *AWS Key Management Service Developer Guide* .
You can use asymmetric KMS keys to encrypt and decrypt data or sign messages and verify signatures. To create an asymmetric key, you must specify an asymmetric `KeySpec` value and a `KeyUsage` value. For details, see [Asymmetric keys in AWS KMS](https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html) in the *AWS Key Management Service Developer Guide* .
You can use HMAC KMS keys (which are also symmetric keys) to generate and verify hash-based message authentication codes. To create an HMAC key, you must specify an HMAC `KeySpec` value and a `KeyUsage` value of `GENERATE_VERIFY_MAC` . For details, see [HMAC keys in AWS KMS](https://docs.aws.amazon.com/kms/latest/developerguide/hmac.html) in the *AWS Key Management Service Developer Guide* .
You can also create symmetric encryption, asymmetric, and HMAC multi-Region primary keys. To create a multi-Region primary key, set the `MultiRegion` property to `true` . For information about multi-Region keys, see [Multi-Region keys in AWS KMS](https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html) in the *AWS Key Management Service Developer Guide* .
You cannot use the `AWS::KMS::Key` resource to specify a KMS key with [imported key material](https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html) or a KMS key in a [custom key store](https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html) .
*Regions*
AWS KMS CloudFormation resources are available in all Regions in which AWS KMS and AWS CloudFormation are supported. You can use the `AWS::KMS::Key` resource to create and manage all KMS key types that are supported in a Region.
Example:
import kms "github.com/aws/aws-cdk-go/awscdk" kmsKey := kms.NewKey(this, jsii.String("myKMSKey")) myBucket := s3.NewBucket(this, jsii.String("mySSEKMSEncryptedBucket"), &BucketProps{ Encryption: s3.BucketEncryption_KMS, EncryptionKey: kmsKey, ObjectOwnership: s3.ObjectOwnership_BUCKET_OWNER_ENFORCED, }) cloudfront.NewDistribution(this, jsii.String("myDist"), &DistributionProps{ DefaultBehavior: &BehaviorOptions{ Origin: origins.S3BucketOrigin_WithOriginAccessControl(myBucket), }, }) // Add the following to scope down the key policy scopedDownKeyPolicy := map[string]interface{}{ "Version": jsii.String("2012-10-17"), "Statement": []interface{}{ map[string]interface{}{ "Effect": jsii.String("Allow"), "Principal": map[string]*string{ "AWS": jsii.String("arn:aws:iam::111122223333:root"), }, "Action": jsii.String("kms:*"), "Resource": jsii.String("*"), }, map[string]interface{}{ "Effect": jsii.String("Allow"), "Principal": map[string]*string{ "Service": jsii.String("cloudfront.amazonaws.com"), }, "Action": []*string{ jsii.String("kms:Decrypt"), jsii.String("kms:Encrypt"), jsii.String("kms:GenerateDataKey*"), }, "Resource": jsii.String("*"), "Condition": map[string]map[string]*string{ "StringEquals": map[string]*string{ "AWS:SourceArn": jsii.String("arn:aws:cloudfront::111122223333:distribution/<CloudFront distribution ID>"), }, }, }, }, } cfnKey := (kmsKey.Node.defaultChild.(cfnKey)) cfnKey.KeyPolicy = scopedDownKeyPolicy
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kms-key.html
func NewCfnKey ¶
func NewCfnKey(scope constructs.Construct, id *string, props *CfnKeyProps) CfnKey
type CfnKeyProps ¶
type CfnKeyProps struct { // Skips ("bypasses") the key policy lockout safety check. The default value is false. // // > Setting this value to true increases the risk that the KMS key becomes unmanageable. Do not set this value to true indiscriminately. // > // > For more information, see [Default key policy](https://docs.aws.amazon.com/kms/latest/developerguide/key-policy-default.html#prevent-unmanageable-key) in the *AWS Key Management Service Developer Guide* . // // Use this parameter only when you intend to prevent the principal that is making the request from making a subsequent [PutKeyPolicy](https://docs.aws.amazon.com/kms/latest/APIReference/API_PutKeyPolicy.html) request on the KMS key. // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kms-key.html#cfn-kms-key-bypasspolicylockoutsafetycheck // // Default: - false. // BypassPolicyLockoutSafetyCheck interface{} `field:"optional" json:"bypassPolicyLockoutSafetyCheck" yaml:"bypassPolicyLockoutSafetyCheck"` // A description of the KMS key. // // Use a description that helps you to distinguish this KMS key from others in the account, such as its intended use. // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kms-key.html#cfn-kms-key-description // Description *string `field:"optional" json:"description" yaml:"description"` // Specifies whether the KMS key is enabled. Disabled KMS keys cannot be used in cryptographic operations. // // When `Enabled` is `true` , the *key state* of the KMS key is `Enabled` . When `Enabled` is `false` , the key state of the KMS key is `Disabled` . The default value is `true` . // // The actual key state of the KMS key might be affected by actions taken outside of CloudFormation, such as running the [EnableKey](https://docs.aws.amazon.com/kms/latest/APIReference/API_EnableKey.html) , [DisableKey](https://docs.aws.amazon.com/kms/latest/APIReference/API_DisableKey.html) , or [ScheduleKeyDeletion](https://docs.aws.amazon.com/kms/latest/APIReference/API_ScheduleKeyDeletion.html) operations. // // For information about the key states of a KMS key, see [Key state: Effect on your KMS key](https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the *AWS Key Management Service Developer Guide* . // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kms-key.html#cfn-kms-key-enabled // Enabled interface{} `field:"optional" json:"enabled" yaml:"enabled"` // Enables automatic rotation of the key material for the specified KMS key. // // By default, automatic key rotation is not enabled. // // AWS KMS supports automatic rotation only for symmetric encryption KMS keys ( `KeySpec` = `SYMMETRIC_DEFAULT` ). For asymmetric KMS keys, HMAC KMS keys, and KMS keys with Origin `EXTERNAL` , omit the `EnableKeyRotation` property or set it to `false` . // // To enable automatic key rotation of the key material for a multi-Region KMS key, set `EnableKeyRotation` to `true` on the primary key (created by using `AWS::KMS::Key` ). AWS KMS copies the rotation status to all replica keys. For details, see [Rotating multi-Region keys](https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-manage.html#multi-region-rotate) in the *AWS Key Management Service Developer Guide* . // // When you enable automatic rotation, AWS KMS automatically creates new key material for the KMS key one year after the enable date and every year thereafter. AWS KMS retains all key material until you delete the KMS key. For detailed information about automatic key rotation, see [Rotating KMS keys](https://docs.aws.amazon.com/kms/latest/developerguide/rotate-keys.html) in the *AWS Key Management Service Developer Guide* . // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kms-key.html#cfn-kms-key-enablekeyrotation // EnableKeyRotation interface{} `field:"optional" json:"enableKeyRotation" yaml:"enableKeyRotation"` // The key policy to attach to the KMS key. // // If you provide a key policy, it must meet the following criteria: // // - The key policy must allow the caller to make a subsequent [PutKeyPolicy](https://docs.aws.amazon.com/kms/latest/APIReference/API_PutKeyPolicy.html) request on the KMS key. This reduces the risk that the KMS key becomes unmanageable. For more information, see [Default key policy](https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html#key-policy-default-allow-root-enable-iam) in the *AWS Key Management Service Developer Guide* . (To omit this condition, set `BypassPolicyLockoutSafetyCheck` to true.) // - Each statement in the key policy must contain one or more principals. The principals in the key policy must exist and be visible to AWS KMS . When you create a new AWS principal (for example, an IAM user or role), you might need to enforce a delay before including the new principal in a key policy because the new principal might not be immediately visible to AWS KMS . For more information, see [Changes that I make are not always immediately visible](https://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_general.html#troubleshoot_general_eventual-consistency) in the *AWS Identity and Access Management User Guide* . // // If you do not provide a key policy, AWS KMS attaches a default key policy to the KMS key. For more information, see [Default key policy](https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html#key-policy-default) in the *AWS Key Management Service Developer Guide* . // // A key policy document can include only the following characters: // // - Printable ASCII characters // - Printable characters in the Basic Latin and Latin-1 Supplement character set // - The tab ( `\u0009` ), line feed ( `\u000A` ), and carriage return ( `\u000D` ) special characters // // *Minimum* : `1` // // *Maximum* : `32768`. // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kms-key.html#cfn-kms-key-keypolicy // KeyPolicy interface{} `field:"optional" json:"keyPolicy" yaml:"keyPolicy"` // Specifies the type of KMS key to create. // // The default value, `SYMMETRIC_DEFAULT` , creates a KMS key with a 256-bit symmetric key for encryption and decryption. In China Regions, `SYMMETRIC_DEFAULT` creates a 128-bit symmetric key that uses SM4 encryption. You can't change the `KeySpec` value after the KMS key is created. For help choosing a key spec for your KMS key, see [Choosing a KMS key type](https://docs.aws.amazon.com/kms/latest/developerguide/symm-asymm-choose.html) in the *AWS Key Management Service Developer Guide* . // // The `KeySpec` property determines the type of key material in the KMS key and the algorithms that the KMS key supports. To further restrict the algorithms that can be used with the KMS key, use a condition key in its key policy or IAM policy. For more information, see [AWS KMS condition keys](https://docs.aws.amazon.com/kms/latest/developerguide/policy-conditions.html#conditions-kms) in the *AWS Key Management Service Developer Guide* . // // > If you change the value of the `KeySpec` property on an existing KMS key, the update request fails, regardless of the value of the [`UpdateReplacePolicy` attribute](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-updatereplacepolicy.html) . This prevents you from accidentally deleting a KMS key by changing an immutable property value. > [AWS services that are integrated with AWS KMS](https://docs.aws.amazon.com/kms/features/#AWS_Service_Integration) use symmetric encryption KMS keys to protect your data. These services do not support encryption with asymmetric KMS keys. For help determining whether a KMS key is asymmetric, see [Identifying asymmetric KMS keys](https://docs.aws.amazon.com/kms/latest/developerguide/find-symm-asymm.html) in the *AWS Key Management Service Developer Guide* . // // AWS KMS supports the following key specs for KMS keys: // // - Symmetric encryption key (default) // // - `SYMMETRIC_DEFAULT` (AES-256-GCM) // - HMAC keys (symmetric) // // - `HMAC_224` // - `HMAC_256` // - `HMAC_384` // - `HMAC_512` // - Asymmetric RSA key pairs (encryption and decryption *or* signing and verification) // // - `RSA_2048` // - `RSA_3072` // - `RSA_4096` // - Asymmetric NIST-recommended elliptic curve key pairs (signing and verification *or* deriving shared secrets) // // - `ECC_NIST_P256` (secp256r1) // - `ECC_NIST_P384` (secp384r1) // - `ECC_NIST_P521` (secp521r1) // - Other asymmetric elliptic curve key pairs (signing and verification) // // - `ECC_SECG_P256K1` (secp256k1), commonly used for cryptocurrencies. // - SM2 key pairs (encryption and decryption *or* signing and verification *or* deriving shared secrets) // // - `SM2` (China Regions only). // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kms-key.html#cfn-kms-key-keyspec // // Default: - "SYMMETRIC_DEFAULT". // KeySpec *string `field:"optional" json:"keySpec" yaml:"keySpec"` // Determines the [cryptographic operations](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#cryptographic-operations) for which you can use the KMS key. The default value is `ENCRYPT_DECRYPT` . This property is required for asymmetric KMS keys and HMAC KMS keys. You can't change the `KeyUsage` value after the KMS key is created. // // > If you change the value of the `KeyUsage` property on an existing KMS key, the update request fails, regardless of the value of the [`UpdateReplacePolicy` attribute](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-updatereplacepolicy.html) . This prevents you from accidentally deleting a KMS key by changing an immutable property value. // // Select only one valid value. // // - For symmetric encryption KMS keys, omit the parameter or specify `ENCRYPT_DECRYPT` . // - For HMAC KMS keys (symmetric), specify `GENERATE_VERIFY_MAC` . // - For asymmetric KMS keys with RSA key pairs, specify `ENCRYPT_DECRYPT` or `SIGN_VERIFY` . // - For asymmetric KMS keys with NIST-recommended elliptic curve key pairs, specify `SIGN_VERIFY` or `KEY_AGREEMENT` . // - For asymmetric KMS keys with `ECC_SECG_P256K1` key pairs specify `SIGN_VERIFY` . // - For asymmetric KMS keys with SM2 key pairs (China Regions only), specify `ENCRYPT_DECRYPT` , `SIGN_VERIFY` , or `KEY_AGREEMENT` . // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kms-key.html#cfn-kms-key-keyusage // // Default: - "ENCRYPT_DECRYPT". // KeyUsage *string `field:"optional" json:"keyUsage" yaml:"keyUsage"` // Creates a multi-Region primary key that you can replicate in other AWS Regions . // // You can't change the `MultiRegion` value after the KMS key is created. // // For a list of AWS Regions in which multi-Region keys are supported, see [Multi-Region keys in AWS KMS](https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html) in the ** . // // > If you change the value of the `MultiRegion` property on an existing KMS key, the update request fails, regardless of the value of the [`UpdateReplacePolicy` attribute](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-updatereplacepolicy.html) . This prevents you from accidentally deleting a KMS key by changing an immutable property value. // // For a multi-Region key, set to this property to `true` . For a single-Region key, omit this property or set it to `false` . The default value is `false` . // // *Multi-Region keys* are an AWS KMS feature that lets you create multiple interoperable KMS keys in different AWS Regions . Because these KMS keys have the same key ID, key material, and other metadata, you can use them to encrypt data in one AWS Region and decrypt it in a different AWS Region without making a cross-Region call or exposing the plaintext data. For more information, see [Multi-Region keys](https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html) in the *AWS Key Management Service Developer Guide* . // // You can create a symmetric encryption, HMAC, or asymmetric multi-Region KMS key, and you can create a multi-Region key with imported key material. However, you cannot create a multi-Region key in a custom key store. // // To create a replica of this primary key in a different AWS Region , create an [AWS::KMS::ReplicaKey](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kms-replicakey.html) resource in a CloudFormation stack in the replica Region. Specify the key ARN of this primary key. // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kms-key.html#cfn-kms-key-multiregion // // Default: - false. // MultiRegion interface{} `field:"optional" json:"multiRegion" yaml:"multiRegion"` // The source of the key material for the KMS key. // // You cannot change the origin after you create the KMS key. The default is `AWS_KMS` , which means that AWS KMS creates the key material. // // To [create a KMS key with no key material](https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys-create-cmk.html) (for imported key material), set this value to `EXTERNAL` . For more information about importing key material into AWS KMS , see [Importing Key Material](https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html) in the *AWS Key Management Service Developer Guide* . // // You can ignore `ENABLED` when Origin is `EXTERNAL` . When a KMS key with Origin `EXTERNAL` is created, the key state is `PENDING_IMPORT` and `ENABLED` is `false` . After you import the key material, `ENABLED` updated to `true` . The KMS key can then be used for Cryptographic Operations. // // > AWS CloudFormation doesn't support creating an `Origin` parameter of the `AWS_CLOUDHSM` or `EXTERNAL_KEY_STORE` values. // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kms-key.html#cfn-kms-key-origin // // Default: - "AWS_KMS". // Origin *string `field:"optional" json:"origin" yaml:"origin"` // Specifies the number of days in the waiting period before AWS KMS deletes a KMS key that has been removed from a CloudFormation stack. // // Enter a value between 7 and 30 days. The default value is 30 days. // // When you remove a KMS key from a CloudFormation stack, AWS KMS schedules the KMS key for deletion and starts the mandatory waiting period. The `PendingWindowInDays` property determines the length of waiting period. During the waiting period, the key state of KMS key is `Pending Deletion` or `Pending Replica Deletion` , which prevents the KMS key from being used in cryptographic operations. When the waiting period expires, AWS KMS permanently deletes the KMS key. // // AWS KMS will not delete a [multi-Region primary key](https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html) that has replica keys. If you remove a multi-Region primary key from a CloudFormation stack, its key state changes to `PendingReplicaDeletion` so it cannot be replicated or used in cryptographic operations. This state can persist indefinitely. When the last of its replica keys is deleted, the key state of the primary key changes to `PendingDeletion` and the waiting period specified by `PendingWindowInDays` begins. When this waiting period expires, AWS KMS deletes the primary key. For details, see [Deleting multi-Region keys](https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-delete.html) in the *AWS Key Management Service Developer Guide* . // // You cannot use a CloudFormation template to cancel deletion of the KMS key after you remove it from the stack, regardless of the waiting period. If you specify a KMS key in your template, even one with the same name, CloudFormation creates a new KMS key. To cancel deletion of a KMS key, use the AWS KMS console or the [CancelKeyDeletion](https://docs.aws.amazon.com/kms/latest/APIReference/API_CancelKeyDeletion.html) operation. // // For information about the `Pending Deletion` and `Pending Replica Deletion` key states, see [Key state: Effect on your KMS key](https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the *AWS Key Management Service Developer Guide* . For more information about deleting KMS keys, see the [ScheduleKeyDeletion](https://docs.aws.amazon.com/kms/latest/APIReference/API_ScheduleKeyDeletion.html) operation in the *AWS Key Management Service API Reference* and [Deleting KMS keys](https://docs.aws.amazon.com/kms/latest/developerguide/deleting-keys.html) in the *AWS Key Management Service Developer Guide* . // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kms-key.html#cfn-kms-key-pendingwindowindays // PendingWindowInDays *float64 `field:"optional" json:"pendingWindowInDays" yaml:"pendingWindowInDays"` // Specifies a custom period of time between each rotation date. // // If no value is specified, the default value is 365 days. // // The rotation period defines the number of days after you enable automatic key rotation that AWS KMS will rotate your key material, and the number of days between each automatic rotation thereafter. // // You can use the [`kms:RotationPeriodInDays`](https://docs.aws.amazon.com/kms/latest/developerguide/conditions-kms.html#conditions-kms-rotation-period-in-days) condition key to further constrain the values that principals can specify in the `RotationPeriodInDays` parameter. // // For more information about rotating KMS keys and automatic rotation, see [Rotating keys](https://docs.aws.amazon.com/kms/latest/developerguide/rotate-keys.html) in the *AWS Key Management Service Developer Guide* . // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kms-key.html#cfn-kms-key-rotationperiodindays // // Default: - 365. // RotationPeriodInDays *float64 `field:"optional" json:"rotationPeriodInDays" yaml:"rotationPeriodInDays"` // Assigns one or more tags to the replica key. // // > Tagging or untagging a KMS key can allow or deny permission to the KMS key. For details, see [ABAC for AWS KMS](https://docs.aws.amazon.com/kms/latest/developerguide/abac.html) in the *AWS Key Management Service Developer Guide* . // // For information about tags in AWS KMS , see [Tagging keys](https://docs.aws.amazon.com/kms/latest/developerguide/tagging-keys.html) in the *AWS Key Management Service Developer Guide* . For information about tags in CloudFormation, see [Tag](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-resource-tags.html) . // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kms-key.html#cfn-kms-key-tags // Tags *[]*awscdk.CfnTag `field:"optional" json:"tags" yaml:"tags"` }
Properties for defining a `CfnKey`.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" var keyPolicy interface{} cfnKeyProps := &CfnKeyProps{ BypassPolicyLockoutSafetyCheck: jsii.Boolean(false), Description: jsii.String("description"), Enabled: jsii.Boolean(false), EnableKeyRotation: jsii.Boolean(false), KeyPolicy: keyPolicy, KeySpec: jsii.String("keySpec"), KeyUsage: jsii.String("keyUsage"), MultiRegion: jsii.Boolean(false), Origin: jsii.String("origin"), PendingWindowInDays: jsii.Number(123), RotationPeriodInDays: jsii.Number(123), Tags: []cfnTag{ &cfnTag{ Key: jsii.String("key"), Value: jsii.String("value"), }, }, }
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kms-key.html
type CfnReplicaKey ¶
type CfnReplicaKey interface { awscdk.CfnResource awscdk.IInspectable awscdk.ITaggable // The Amazon Resource Name (ARN) of the replica key, such as `arn:aws:kms:us-west-2:111122223333:key/mrk-1234abcd12ab34cd56ef1234567890ab` . // // The key ARNs of related multi-Region keys differ only in the Region value. For information about the key ARNs of multi-Region keys, see [How multi-Region keys work](https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html#mrk-how-it-works) in the *AWS Key Management Service Developer Guide* . AttrArn() *string // The key ID of the replica key, such as `mrk-1234abcd12ab34cd56ef1234567890ab` . // // Related multi-Region keys have the same key ID. For information about the key IDs of multi-Region keys, see [How multi-Region keys work](https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html#mrk-how-it-works) in the *AWS Key Management Service Developer Guide* . AttrKeyId() *string // Options for this resource, such as condition, update policy etc. CfnOptions() awscdk.ICfnResourceOptions CfnProperties() *map[string]interface{} // AWS resource type. CfnResourceType() *string // Returns: the stack trace of the point where this Resource was created from, sourced // from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most // node +internal+ entries filtered. CreationStack() *[]*string // A description of the KMS key. Description() *string SetDescription(val *string) // Specifies whether the replica key is enabled. // // Disabled KMS keys cannot be used in cryptographic operations. Enabled() interface{} SetEnabled(val interface{}) // The key policy that authorizes use of the replica key. KeyPolicy() interface{} SetKeyPolicy(val interface{}) // The logical ID for this CloudFormation stack element. // // The logical ID of the element // is calculated from the path of the resource node in the construct tree. // // To override this value, use `overrideLogicalId(newLogicalId)`. // // Returns: the logical ID as a stringified token. This value will only get // resolved during synthesis. LogicalId() *string // The tree node. Node() constructs.Node // Specifies the number of days in the waiting period before AWS KMS deletes a replica key that has been removed from a CloudFormation stack. PendingWindowInDays() *float64 SetPendingWindowInDays(val *float64) // Specifies the multi-Region primary key to replicate. PrimaryKeyArn() *string SetPrimaryKeyArn(val *string) // Return a string that will be resolved to a CloudFormation `{ Ref }` for this element. // // If, by any chance, the intrinsic reference of a resource is not a string, you could // coerce it to an IResolvable through `Lazy.any({ produce: resource.ref })`. Ref() *string // The stack in which this element is defined. // // CfnElements must be defined within a stack scope (directly or indirectly). Stack() awscdk.Stack // Tag Manager which manages the tags for this resource. Tags() awscdk.TagManager // Assigns one or more tags to the replica key. TagsRaw() *[]*awscdk.CfnTag SetTagsRaw(val *[]*awscdk.CfnTag) // Deprecated. // Deprecated: use `updatedProperties` // // Return properties modified after initiation // // Resources that expose mutable properties should override this function to // collect and return the properties object for this resource. UpdatedProperites() *map[string]interface{} // Return properties modified after initiation. // // Resources that expose mutable properties should override this function to // collect and return the properties object for this resource. UpdatedProperties() *map[string]interface{} // Syntactic sugar for `addOverride(path, undefined)`. AddDeletionOverride(path *string) // Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned. // // This can be used for resources across stacks (or nested stack) boundaries // and the dependency will automatically be transferred to the relevant scope. AddDependency(target awscdk.CfnResource) // Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned. // Deprecated: use addDependency. AddDependsOn(target awscdk.CfnResource) // Add a value to the CloudFormation Resource Metadata. // See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html // // Note that this is a different set of metadata from CDK node metadata; this // metadata ends up in the stack template under the resource, whereas CDK // node metadata ends up in the Cloud Assembly. // AddMetadata(key *string, value interface{}) // Adds an override to the synthesized CloudFormation resource. // // To add a // property override, either use `addPropertyOverride` or prefix `path` with // "Properties." (i.e. `Properties.TopicName`). // // If the override is nested, separate each nested level using a dot (.) in the path parameter. // If there is an array as part of the nesting, specify the index in the path. // // To include a literal `.` in the property name, prefix with a `\`. In most // programming languages you will need to write this as `"\\."` because the // `\` itself will need to be escaped. // // For example, // “`typescript // cfnResource.addOverride('Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes', ['myattribute']); // cfnResource.addOverride('Properties.GlobalSecondaryIndexes.1.ProjectionType', 'INCLUDE'); // “` // would add the overrides // “`json // "Properties": { // "GlobalSecondaryIndexes": [ // { // "Projection": { // "NonKeyAttributes": [ "myattribute" ] // ... // } // ... // }, // { // "ProjectionType": "INCLUDE" // ... // }, // ] // ... // } // “` // // The `value` argument to `addOverride` will not be processed or translated // in any way. Pass raw JSON values in here with the correct capitalization // for CloudFormation. If you pass CDK classes or structs, they will be // rendered with lowercased key names, and CloudFormation will reject the // template. AddOverride(path *string, value interface{}) // Adds an override that deletes the value of a property from the resource definition. AddPropertyDeletionOverride(propertyPath *string) // Adds an override to a resource property. // // Syntactic sugar for `addOverride("Properties.<...>", value)`. AddPropertyOverride(propertyPath *string, value interface{}) // Sets the deletion policy of the resource based on the removal policy specified. // // The Removal Policy controls what happens to this resource when it stops // being managed by CloudFormation, either because you've removed it from the // CDK application or because you've made a change that requires the resource // to be replaced. // // The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS // account for data recovery and cleanup later (`RemovalPolicy.RETAIN`). In some // cases, a snapshot can be taken of the resource prior to deletion // (`RemovalPolicy.SNAPSHOT`). A list of resources that support this policy // can be found in the following link:. // See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html#aws-attribute-deletionpolicy-options // ApplyRemovalPolicy(policy awscdk.RemovalPolicy, options *awscdk.RemovalPolicyOptions) // Returns a token for an runtime attribute of this resource. // // Ideally, use generated attribute accessors (e.g. `resource.arn`), but this can be used for future compatibility // in case there is no generated attribute. GetAtt(attributeName *string, typeHint awscdk.ResolutionTypeHint) awscdk.Reference // Retrieve a value value from the CloudFormation Resource Metadata. // See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html // // Note that this is a different set of metadata from CDK node metadata; this // metadata ends up in the stack template under the resource, whereas CDK // node metadata ends up in the Cloud Assembly. // GetMetadata(key *string) interface{} // Examines the CloudFormation resource and discloses attributes. Inspect(inspector awscdk.TreeInspector) // Retrieves an array of resources this resource depends on. // // This assembles dependencies on resources across stacks (including nested stacks) // automatically. ObtainDependencies() *[]interface{} // Get a shallow copy of dependencies between this resource and other resources in the same stack. ObtainResourceDependencies() *[]awscdk.CfnResource // Overrides the auto-generated logical ID with a specific ID. OverrideLogicalId(newLogicalId *string) // Indicates that this resource no longer depends on another resource. // // This can be used for resources across stacks (including nested stacks) // and the dependency will automatically be removed from the relevant scope. RemoveDependency(target awscdk.CfnResource) RenderProperties(props *map[string]interface{}) *map[string]interface{} // Replaces one dependency with another. ReplaceDependency(target awscdk.CfnResource, newTarget awscdk.CfnResource) // Can be overridden by subclasses to determine if this resource will be rendered into the cloudformation template. // // Returns: `true` if the resource should be included or `false` is the resource // should be omitted. ShouldSynthesize() *bool // Returns a string representation of this construct. // // Returns: a string representation of this resource. ToString() *string ValidateProperties(_properties interface{}) }
The `AWS::KMS::ReplicaKey` resource specifies a multi-Region replica key that is based on a multi-Region primary key.
*Multi-Region keys* are an AWS KMS feature that lets you create multiple interoperable KMS keys in different AWS Regions . Because these KMS keys have the same key ID, key material, and other metadata, you can use them to encrypt data in one AWS Region and decrypt it in a different AWS Region without making a cross-Region call or exposing the plaintext data. For more information, see [Multi-Region keys](https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html) in the *AWS Key Management Service Developer Guide* .
A multi-Region *primary key* is a fully functional symmetric encryption KMS key, HMAC KMS key, or asymmetric KMS key that is also the model for replica keys in other AWS Regions . To create a multi-Region primary key, add an [AWS::KMS::Key](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kms-key.html) resource to your CloudFormation stack. Set its `MultiRegion` property to true.
A multi-Region *replica key* is a fully functional KMS key that has the same key ID and key material as a multi-Region primary key, but is located in a different AWS Region of the same AWS partition. There can be multiple replicas of a primary key, but each must be in a different AWS Region .
When you create a replica key in AWS CloudFormation , the replica key is created in the AWS Region represented by the endpoint you use for the request. If you try to replicate a multi-Region key into a Region in which the key type is not supported, the request will fail.
A primary key and its replicas have the same key ID and key material. They also have the same key spec, key usage, key material origin, and automatic key rotation status. These properties are known as *shared properties* . If they change, AWS KMS synchronizes the change to all related multi-Region keys. All other properties of a replica key can differ, including its key policy, tags, aliases, and key state. AWS KMS does not synchronize these properties.
*Regions*
AWS KMS CloudFormation resources are available in all AWS Regions in which AWS KMS and AWS CloudFormation are supported. You can use the `AWS::KMS::ReplicaKey` resource to create replica keys in all Regions that support multi-Region KMS keys. For details, see [Multi-Region keys in AWS KMS](https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html) in the ** .
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" var keyPolicy interface{} cfnReplicaKey := awscdk.Aws_kms.NewCfnReplicaKey(this, jsii.String("MyCfnReplicaKey"), &CfnReplicaKeyProps{ KeyPolicy: keyPolicy, PrimaryKeyArn: jsii.String("primaryKeyArn"), // the properties below are optional Description: jsii.String("description"), Enabled: jsii.Boolean(false), PendingWindowInDays: jsii.Number(123), Tags: []cfnTag{ &cfnTag{ Key: jsii.String("key"), Value: jsii.String("value"), }, }, })
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kms-replicakey.html
func NewCfnReplicaKey ¶
func NewCfnReplicaKey(scope constructs.Construct, id *string, props *CfnReplicaKeyProps) CfnReplicaKey
type CfnReplicaKeyProps ¶
type CfnReplicaKeyProps struct { // The key policy that authorizes use of the replica key. // // The key policy is not a shared property of multi-Region keys. You can specify the same key policy or a different key policy for each key in a set of related multi-Region keys. AWS KMS does not synchronize this property. // // The key policy must conform to the following rules. // // - The key policy must give the caller [PutKeyPolicy](https://docs.aws.amazon.com/kms/latest/APIReference/API_PutKeyPolicy.html) permission on the KMS key. This reduces the risk that the KMS key becomes unmanageable. For more information, refer to the scenario in the [Default key policy](https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html#key-policy-default-allow-root-enable-iam) section of the **AWS Key Management Service Developer Guide** . // - Each statement in the key policy must contain one or more principals. The principals in the key policy must exist and be visible to AWS KMS . When you create a new AWS principal (for example, an IAM user or role), you might need to enforce a delay before including the new principal in a key policy because the new principal might not be immediately visible to AWS KMS . For more information, see [Changes that I make are not always immediately visible](https://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_general.html#troubleshoot_general_eventual-consistency) in the *AWS Identity and Access Management User Guide* . // // A key policy document can include only the following characters: // // - Printable ASCII characters from the space character ( `\u0020` ) through the end of the ASCII character range. // - Printable characters in the Basic Latin and Latin-1 Supplement character set (through `\u00FF` ). // - The tab ( `\u0009` ), line feed ( `\u000A` ), and carriage return ( `\u000D` ) special characters // // *Minimum* : `1` // // *Maximum* : `32768`. // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kms-replicakey.html#cfn-kms-replicakey-keypolicy // KeyPolicy interface{} `field:"required" json:"keyPolicy" yaml:"keyPolicy"` // Specifies the multi-Region primary key to replicate. // // The primary key must be in a different AWS Region of the same AWS partition. You can create only one replica of a given primary key in each AWS Region . // // > If you change the `PrimaryKeyArn` value of a replica key, the existing replica key is scheduled for deletion and a new replica key is created based on the specified primary key. While it is scheduled for deletion, the existing replica key becomes unusable. You can cancel the scheduled deletion of the key outside of CloudFormation. // > // > However, if you inadvertently delete a replica key, you can decrypt ciphertext encrypted by that replica key by using any related multi-Region key. If necessary, you can recreate the replica in the same Region after the previous one is completely deleted. For details, see [Deleting multi-Region keys](https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-delete.html) in the *AWS Key Management Service Developer Guide* // // Specify the key ARN of an existing multi-Region primary key. For example, `arn:aws:kms:us-east-2:111122223333:key/mrk-1234abcd12ab34cd56ef1234567890ab` . // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kms-replicakey.html#cfn-kms-replicakey-primarykeyarn // PrimaryKeyArn *string `field:"required" json:"primaryKeyArn" yaml:"primaryKeyArn"` // A description of the KMS key. // // The default value is an empty string (no description). // // The description is not a shared property of multi-Region keys. You can specify the same description or a different description for each key in a set of related multi-Region keys. AWS Key Management Service does not synchronize this property. // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kms-replicakey.html#cfn-kms-replicakey-description // Description *string `field:"optional" json:"description" yaml:"description"` // Specifies whether the replica key is enabled. Disabled KMS keys cannot be used in cryptographic operations. // // When `Enabled` is `true` , the *key state* of the KMS key is `Enabled` . When `Enabled` is `false` , the key state of the KMS key is `Disabled` . The default value is `true` . // // The actual key state of the replica might be affected by actions taken outside of CloudFormation, such as running the [EnableKey](https://docs.aws.amazon.com/kms/latest/APIReference/API_EnableKey.html) , [DisableKey](https://docs.aws.amazon.com/kms/latest/APIReference/API_DisableKey.html) , or [ScheduleKeyDeletion](https://docs.aws.amazon.com/kms/latest/APIReference/API_ScheduleKeyDeletion.html) operations. Also, while the replica key is being created, its key state is `Creating` . When the process is complete, the key state of the replica key changes to `Enabled` . // // For information about the key states of a KMS key, see [Key state: Effect on your KMS key](https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the *AWS Key Management Service Developer Guide* . // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kms-replicakey.html#cfn-kms-replicakey-enabled // Enabled interface{} `field:"optional" json:"enabled" yaml:"enabled"` // Specifies the number of days in the waiting period before AWS KMS deletes a replica key that has been removed from a CloudFormation stack. // // Enter a value between 7 and 30 days. The default value is 30 days. // // When you remove a replica key from a CloudFormation stack, AWS KMS schedules the replica key for deletion and starts the mandatory waiting period. The `PendingWindowInDays` property determines the length of waiting period. During the waiting period, the key state of replica key is `Pending Deletion` , which prevents it from being used in cryptographic operations. When the waiting period expires, AWS KMS permanently deletes the replica key. // // If the KMS key is a multi-Region primary key with replica keys, the waiting period begins when the last of its replica keys is deleted. Otherwise, the waiting period begins immediately. // // You cannot use a CloudFormation template to cancel deletion of the replica after you remove it from the stack, regardless of the waiting period. However, if you specify a replica key in your template that is based on the same primary key as the original replica key, CloudFormation creates a new replica key with the same key ID, key material, and other shared properties of the original replica key. This new replica key can decrypt ciphertext that was encrypted under the original replica key, or any related multi-Region key. // // For detailed information about deleting multi-Region keys, see [Deleting multi-Region keys](https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-delete.html) in the *AWS Key Management Service Developer Guide* . // // For information about the `PendingDeletion` key state, see [Key state: Effect on your KMS key](https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html) in the *AWS Key Management Service Developer Guide* . For more information about deleting KMS keys, see the [ScheduleKeyDeletion](https://docs.aws.amazon.com/kms/latest/APIReference/API_ScheduleKeyDeletion.html) operation in the *AWS Key Management Service API Reference* and [Deleting KMS keys](https://docs.aws.amazon.com/kms/latest/developerguide/deleting-keys.html) in the *AWS Key Management Service Developer Guide* . // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kms-replicakey.html#cfn-kms-replicakey-pendingwindowindays // PendingWindowInDays *float64 `field:"optional" json:"pendingWindowInDays" yaml:"pendingWindowInDays"` // Assigns one or more tags to the replica key. // // > Tagging or untagging a KMS key can allow or deny permission to the KMS key. For details, see [ABAC for AWS KMS](https://docs.aws.amazon.com/kms/latest/developerguide/abac.html) in the *AWS Key Management Service Developer Guide* . // // Tags are not a shared property of multi-Region keys. You can specify the same tags or different tags for each key in a set of related multi-Region keys. AWS KMS does not synchronize this property. // // Each tag consists of a tag key and a tag value. Both the tag key and the tag value are required, but the tag value can be an empty (null) string. You cannot have more than one tag on a KMS key with the same tag key. If you specify an existing tag key with a different tag value, AWS KMS replaces the current tag value with the specified one. // // When you assign tags to an AWS resource, AWS generates a cost allocation report with usage and costs aggregated by tags. Tags can also be used to control access to a KMS key. For details, see [Tagging keys](https://docs.aws.amazon.com/kms/latest/developerguide/tagging-keys.html) . // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kms-replicakey.html#cfn-kms-replicakey-tags // Tags *[]*awscdk.CfnTag `field:"optional" json:"tags" yaml:"tags"` }
Properties for defining a `CfnReplicaKey`.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" var keyPolicy interface{} cfnReplicaKeyProps := &CfnReplicaKeyProps{ KeyPolicy: keyPolicy, PrimaryKeyArn: jsii.String("primaryKeyArn"), // the properties below are optional Description: jsii.String("description"), Enabled: jsii.Boolean(false), PendingWindowInDays: jsii.Number(123), Tags: []cfnTag{ &cfnTag{ Key: jsii.String("key"), Value: jsii.String("value"), }, }, }
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kms-replicakey.html
type IAlias ¶
type IAlias interface { IKey // The name of the alias. AliasName() *string // The Key to which the Alias refers. AliasTargetKey() IKey }
A KMS Key alias.
An alias can be used in all places that expect a key.
func Alias_FromAliasAttributes ¶
func Alias_FromAliasAttributes(scope constructs.Construct, id *string, attrs *AliasAttributes) IAlias
Import an existing KMS Alias defined outside the CDK app.
func Alias_FromAliasName ¶
Import an existing KMS Alias defined outside the CDK app, by the alias name.
This method should be used instead of 'fromAliasAttributes' when the underlying KMS Key ARN is not available. This Alias will not have a direct reference to the KMS Key, so addAlias and grant* methods are not supported.
type IKey ¶
type IKey interface { awscdk.IResource // Defines a new alias for the key. AddAlias(alias *string) Alias // Adds a statement to the KMS key resource policy. AddToResourcePolicy(statement awsiam.PolicyStatement, allowNoOp *bool) *awsiam.AddToResourcePolicyResult // Grant the indicated permissions on this key to the given principal. Grant(grantee awsiam.IGrantable, actions ...*string) awsiam.Grant // Grant decryption permissions using this key to the given principal. GrantDecrypt(grantee awsiam.IGrantable) awsiam.Grant // Grant encryption permissions using this key to the given principal. GrantEncrypt(grantee awsiam.IGrantable) awsiam.Grant // Grant encryption and decryption permissions using this key to the given principal. GrantEncryptDecrypt(grantee awsiam.IGrantable) awsiam.Grant // Grant permissions to generating MACs to the given principal. GrantGenerateMac(grantee awsiam.IGrantable) awsiam.Grant // Grant permissions to verifying MACs to the given principal. GrantVerifyMac(grantee awsiam.IGrantable) awsiam.Grant // The ARN of the key. KeyArn() *string // The ID of the key (the part that looks something like: 1234abcd-12ab-34cd-56ef-1234567890ab). KeyId() *string }
A KMS Key, either managed by this CDK app, or imported.
func Key_FromCfnKey ¶
Create a mutable `IKey` based on a low-level `CfnKey`.
This is most useful when combined with the cloudformation-include module. This method is different than `fromKeyArn()` because the `IKey` returned from this method is mutable; meaning, calling any mutating methods on it, like `IKey.addToResourcePolicy()`, will actually be reflected in the resulting template, as opposed to the object returned from `fromKeyArn()`, on which calling those methods would have no effect.
func Key_FromKeyArn ¶
Import an externally defined KMS Key using its ARN.
func Key_FromLookup ¶
func Key_FromLookup(scope constructs.Construct, id *string, options *KeyLookupOptions) IKey
Import an existing Key by querying the AWS environment this stack is deployed to.
This function only needs to be used to use Keys not defined in your CDK application. If you are looking to share a Key between stacks, you can pass the `Key` object between stacks and use it as normal. In addition, it's not necessary to use this method if an interface accepts an `IKey`. In this case, `Alias.fromAliasName()` can be used which returns an alias that extends `IKey`.
Calling this method will lead to a lookup when the CDK CLI is executed. You can therefore not use any values that will only be available at CloudFormation execution time (i.e., Tokens).
If you set `returnDummyKeyOnMissing` to `true` in `options` and the key was not found, this method will return a dummy key with a key id '1234abcd-12ab-34cd-56ef-1234567890ab'. The value of the dummy key id can also be referenced using the `Key.DEFAULT_DUMMY_KEY_ID` variable, and you can check if the key is a dummy key by using the `Key.isLookupDummy()` method.
The Key information will be cached in `cdk.context.json` and the same Key will be used on future runs. To refresh the lookup, you will have to evict the value from the cache using the `cdk context` command. See https://docs.aws.amazon.com/cdk/latest/guide/context.html for more information.
type Key ¶
type Key interface { awscdk.Resource IKey // The environment this resource belongs to. // // For resources that are created and managed by the CDK // (generally, those created by creating new class instances like Role, Bucket, etc.), // this is always the same as the environment of the stack they belong to; // however, for imported resources // (those obtained from static methods like fromRoleArn, fromBucketName, etc.), // that might be different than the stack they were imported into. Env() *awscdk.ResourceEnvironment // The ARN of the key. KeyArn() *string // The ID of the key (the part that looks something like: 1234abcd-12ab-34cd-56ef-1234567890ab). KeyId() *string // The tree node. Node() constructs.Node // Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource. // // This value will resolve to one of the following: // - a concrete value (e.g. `"my-awesome-bucket"`) // - `undefined`, when a name should be generated by CloudFormation // - a concrete name generated automatically during synthesis, in // cross-environment scenarios. PhysicalName() *string // Optional policy document that represents the resource policy of this key. // // If specified, addToResourcePolicy can be used to edit this policy. // Otherwise this method will no-op. Policy() awsiam.PolicyDocument // The stack in which this resource is defined. Stack() awscdk.Stack // Optional property to control trusting account identities. // // If specified, grants will default identity policies instead of to both // resource and identity policies. This matches the default behavior when creating // KMS keys via the API or console. TrustAccountIdentities() *bool // Defines a new alias for the key. AddAlias(aliasName *string) Alias // Adds a statement to the KMS key resource policy. AddToResourcePolicy(statement awsiam.PolicyStatement, allowNoOp *bool) *awsiam.AddToResourcePolicyResult // Apply the given removal policy to this resource. // // The Removal Policy controls what happens to this resource when it stops // being managed by CloudFormation, either because you've removed it from the // CDK application or because you've made a change that requires the resource // to be replaced. // // The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS // account for data recovery and cleanup later (`RemovalPolicy.RETAIN`). ApplyRemovalPolicy(policy awscdk.RemovalPolicy) GeneratePhysicalName() *string // Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. `bucket.bucketArn`). // // Normally, this token will resolve to `arnAttr`, but if the resource is // referenced across environments, `arnComponents` will be used to synthesize // a concrete ARN with the resource's physical name. Make sure to reference // `this.physicalName` in `arnComponents`. GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string // Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. `bucket.bucketName`). // // Normally, this token will resolve to `nameAttr`, but if the resource is // referenced across environments, it will be resolved to `this.physicalName`, // which will be a concrete name. GetResourceNameAttribute(nameAttr *string) *string // Grant the indicated permissions on this key to the given principal. // // This modifies both the principal's policy as well as the resource policy, // since the default CloudFormation setup for KMS keys is that the policy // must not be empty and so default grants won't work. Grant(grantee awsiam.IGrantable, actions ...*string) awsiam.Grant // Grant admins permissions using this key to the given principal. // // Key administrators have permissions to manage the key (e.g., change permissions, revoke), but do not have permissions // to use the key in cryptographic operations (e.g., encrypt, decrypt). GrantAdmin(grantee awsiam.IGrantable) awsiam.Grant // Grant decryption permissions using this key to the given principal. GrantDecrypt(grantee awsiam.IGrantable) awsiam.Grant // Grant encryption permissions using this key to the given principal. GrantEncrypt(grantee awsiam.IGrantable) awsiam.Grant // Grant encryption and decryption permissions using this key to the given principal. GrantEncryptDecrypt(grantee awsiam.IGrantable) awsiam.Grant // Grant permissions to generating MACs to the given principal. GrantGenerateMac(grantee awsiam.IGrantable) awsiam.Grant // Grant permissions to verifying MACs to the given principal. GrantVerifyMac(grantee awsiam.IGrantable) awsiam.Grant // Returns a string representation of this construct. ToString() *string }
Defines a KMS key.
Example:
import kms "github.com/aws/aws-cdk-go/awscdk" myKmsKey := kms.NewKey(this, jsii.String("myKMSKey")) myBucket := s3.NewBucket(this, jsii.String("mySSEKMSEncryptedBucket"), &BucketProps{ Encryption: s3.BucketEncryption_KMS, EncryptionKey: myKmsKey, ObjectOwnership: s3.ObjectOwnership_BUCKET_OWNER_ENFORCED, }) cloudfront.NewDistribution(this, jsii.String("myDist"), &DistributionProps{ DefaultBehavior: &BehaviorOptions{ Origin: origins.S3BucketOrigin_WithOriginAccessControl(myBucket), }, })
type KeyLookupOptions ¶
type KeyLookupOptions struct { // The alias name of the Key. // // Must be in the format `alias/<AliasName>`. AliasName *string `field:"required" json:"aliasName" yaml:"aliasName"` // Whether to return a dummy key if the key was not found. // // If it is set to `true` and the key was not found, a dummy // key with a key id '1234abcd-12ab-34cd-56ef-1234567890ab' // will be returned. The value of the dummy key id can also // be referenced using the `Key.DEFAULT_DUMMY_KEY_ID` variable, // and you can check if the key is a dummy key by using the // `Key.isLookupDummy()` method. // Default: false. // ReturnDummyKeyOnMissing *bool `field:"optional" json:"returnDummyKeyOnMissing" yaml:"returnDummyKeyOnMissing"` }
Properties for looking up an existing Key.
Example:
myKeyLookup := kms.Key_FromLookup(this, jsii.String("MyKeyLookup"), &KeyLookupOptions{ AliasName: jsii.String("alias/KeyAlias"), }) role := iam.NewRole(this, jsii.String("MyRole"), &RoleProps{ AssumedBy: iam.NewServicePrincipal(jsii.String("lambda.amazonaws.com")), }) myKeyLookup.GrantEncryptDecrypt(role)
type KeyProps ¶
type KeyProps struct { // A list of principals to add as key administrators to the key policy. // // Key administrators have permissions to manage the key (e.g., change permissions, revoke), but do not have permissions // to use the key in cryptographic operations (e.g., encrypt, decrypt). // // These principals will be added to the default key policy (if none specified), or to the specified policy (if provided). // Default: []. // Admins *[]awsiam.IPrincipal `field:"optional" json:"admins" yaml:"admins"` // Initial alias to add to the key. // // More aliases can be added later by calling `addAlias`. // Default: - No alias is added for the key. // Alias *string `field:"optional" json:"alias" yaml:"alias"` // A description of the key. // // Use a description that helps your users decide // whether the key is appropriate for a particular task. // Default: - No description. // Description *string `field:"optional" json:"description" yaml:"description"` // Indicates whether the key is available for use. // Default: - Key is enabled. // Enabled *bool `field:"optional" json:"enabled" yaml:"enabled"` // Indicates whether AWS KMS rotates the key. // Default: false. // EnableKeyRotation *bool `field:"optional" json:"enableKeyRotation" yaml:"enableKeyRotation"` // The cryptographic configuration of the key. The valid value depends on usage of the key. // // IMPORTANT: If you change this property of an existing key, the existing key is scheduled for deletion // and a new key is created with the specified value. // Default: KeySpec.SYMMETRIC_DEFAULT // KeySpec KeySpec `field:"optional" json:"keySpec" yaml:"keySpec"` // The cryptographic operations for which the key can be used. // // IMPORTANT: If you change this property of an existing key, the existing key is scheduled for deletion // and a new key is created with the specified value. // Default: KeyUsage.ENCRYPT_DECRYPT // KeyUsage KeyUsage `field:"optional" json:"keyUsage" yaml:"keyUsage"` // Creates a multi-Region primary key that you can replicate in other AWS Regions. // // You can't change the `multiRegion` value after the KMS key is created. // // IMPORTANT: If you change the value of the `multiRegion` property on an existing KMS key, the update request fails, // regardless of the value of the UpdateReplacePolicy attribute. // This prevents you from accidentally deleting a KMS key by changing an immutable property value. // See: https://docs.aws.amazon.com/kms/latest/developerguide/multi-region-keys-overview.html // // Default: false. // MultiRegion *bool `field:"optional" json:"multiRegion" yaml:"multiRegion"` // Specifies the number of days in the waiting period before AWS KMS deletes a CMK that has been removed from a CloudFormation stack. // // When you remove a customer master key (CMK) from a CloudFormation stack, AWS KMS schedules the CMK for deletion // and starts the mandatory waiting period. The PendingWindowInDays property determines the length of waiting period. // During the waiting period, the key state of CMK is Pending Deletion, which prevents the CMK from being used in // cryptographic operations. When the waiting period expires, AWS KMS permanently deletes the CMK. // // Enter a value between 7 and 30 days. // See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kms-key.html#cfn-kms-key-pendingwindowindays // // Default: - 30 days. // PendingWindow awscdk.Duration `field:"optional" json:"pendingWindow" yaml:"pendingWindow"` // Custom policy document to attach to the KMS key. // // NOTE - If the `@aws-cdk/aws-kms:defaultKeyPolicies` feature flag is set (the default for new projects), // this policy will *override* the default key policy and become the only key policy for the key. If the // feature flag is not set, this policy will be appended to the default key policy. // Default: - A policy document with permissions for the account root to // administer the key will be created. // Policy awsiam.PolicyDocument `field:"optional" json:"policy" yaml:"policy"` // Whether the encryption key should be retained when it is removed from the Stack. // // This is useful when one wants to // retain access to data that was encrypted with a key that is being retired. // Default: RemovalPolicy.Retain // RemovalPolicy awscdk.RemovalPolicy `field:"optional" json:"removalPolicy" yaml:"removalPolicy"` // The period between each automatic rotation. // Default: - set by CFN to 365 days. // RotationPeriod awscdk.Duration `field:"optional" json:"rotationPeriod" yaml:"rotationPeriod"` }
Construction properties for a KMS Key object.
Example:
import kms "github.com/aws/aws-cdk-go/awscdk" sourceOutput := codepipeline.NewArtifact() targetBucket := s3.NewBucket(this, jsii.String("MyBucket")) key := kms.NewKey(this, jsii.String("EnvVarEncryptKey"), &KeyProps{ Description: jsii.String("sample key"), }) pipeline := codepipeline.NewPipeline(this, jsii.String("MyPipeline")) deployAction := codepipeline_actions.NewS3DeployAction(&S3DeployActionProps{ ActionName: jsii.String("S3Deploy"), Bucket: targetBucket, Input: sourceOutput, EncryptionKey: key, }) deployStage := pipeline.AddStage(&StageOptions{ StageName: jsii.String("Deploy"), Actions: []iAction{ deployAction, }, })
type KeySpec ¶
type KeySpec string
The key spec, represents the cryptographic configuration of keys.
Example:
key := kms.NewKey(this, jsii.String("MyKey"), &KeyProps{ KeySpec: kms.KeySpec_ECC_SECG_P256K1, // Default to SYMMETRIC_DEFAULT KeyUsage: kms.KeyUsage_SIGN_VERIFY, })
const ( // The default key spec. // // Valid usage: ENCRYPT_DECRYPT. KeySpec_SYMMETRIC_DEFAULT KeySpec = "SYMMETRIC_DEFAULT" // RSA with 2048 bits of key. // // Valid usage: ENCRYPT_DECRYPT and SIGN_VERIFY. KeySpec_RSA_2048 KeySpec = "RSA_2048" // RSA with 3072 bits of key. // // Valid usage: ENCRYPT_DECRYPT and SIGN_VERIFY. KeySpec_RSA_3072 KeySpec = "RSA_3072" // RSA with 4096 bits of key. // // Valid usage: ENCRYPT_DECRYPT and SIGN_VERIFY. KeySpec_RSA_4096 KeySpec = "RSA_4096" // NIST FIPS 186-4, Section 6.4, ECDSA signature using the curve specified by the key and SHA-256 for the message digest. // // Valid usage: SIGN_VERIFY. KeySpec_ECC_NIST_P256 KeySpec = "ECC_NIST_P256" // NIST FIPS 186-4, Section 6.4, ECDSA signature using the curve specified by the key and SHA-384 for the message digest. // // Valid usage: SIGN_VERIFY. KeySpec_ECC_NIST_P384 KeySpec = "ECC_NIST_P384" // NIST FIPS 186-4, Section 6.4, ECDSA signature using the curve specified by the key and SHA-512 for the message digest. // // Valid usage: SIGN_VERIFY. KeySpec_ECC_NIST_P521 KeySpec = "ECC_NIST_P521" // Standards for Efficient Cryptography 2, Section 2.4.1, ECDSA signature on the Koblitz curve. // // Valid usage: SIGN_VERIFY. KeySpec_ECC_SECG_P256K1 KeySpec = "ECC_SECG_P256K1" // Hash-Based Message Authentication Code as defined in RFC 2104 using the message digest function SHA224. // // Valid usage: GENERATE_VERIFY_MAC. KeySpec_HMAC_224 KeySpec = "HMAC_224" // Hash-Based Message Authentication Code as defined in RFC 2104 using the message digest function SHA256. // // Valid usage: GENERATE_VERIFY_MAC. KeySpec_HMAC_256 KeySpec = "HMAC_256" // Hash-Based Message Authentication Code as defined in RFC 2104 using the message digest function SHA384. // // Valid usage: GENERATE_VERIFY_MAC. KeySpec_HMAC_384 KeySpec = "HMAC_384" // Hash-Based Message Authentication Code as defined in RFC 2104 using the message digest function SHA512. // // Valid usage: GENERATE_VERIFY_MAC. KeySpec_HMAC_512 KeySpec = "HMAC_512" // Elliptic curve key spec available only in China Regions. // // Valid usage: ENCRYPT_DECRYPT and SIGN_VERIFY. KeySpec_SM2 KeySpec = "SM2" )
type KeyUsage ¶
type KeyUsage string
The key usage, represents the cryptographic operations of keys.
Example:
key := kms.NewKey(this, jsii.String("MyKey"), &KeyProps{ KeySpec: kms.KeySpec_ECC_SECG_P256K1, // Default to SYMMETRIC_DEFAULT KeyUsage: kms.KeyUsage_SIGN_VERIFY, })
const ( // Encryption and decryption. KeyUsage_ENCRYPT_DECRYPT KeyUsage = "ENCRYPT_DECRYPT" // Signing and verification. KeyUsage_SIGN_VERIFY KeyUsage = "SIGN_VERIFY" // Generating and verifying MACs. KeyUsage_GENERATE_VERIFY_MAC KeyUsage = "GENERATE_VERIFY_MAC" // Deriving shared secrets. KeyUsage_KEY_AGREEMENT KeyUsage = "KEY_AGREEMENT" )
type ViaServicePrincipal ¶
type ViaServicePrincipal interface { awsiam.PrincipalBase // When this Principal is used in an AssumeRole policy, the action to use. AssumeRoleAction() *string // The principal to grant permissions to. GrantPrincipal() awsiam.IPrincipal // Return the policy fragment that identifies this principal in a Policy. PolicyFragment() awsiam.PrincipalPolicyFragment // The AWS account ID of this principal. // // Can be undefined when the account is not known // (for example, for service principals). // Can be a Token - in that case, // it's assumed to be AWS::AccountId. PrincipalAccount() *string // Add the principal to the AssumeRolePolicyDocument. // // Add the statements to the AssumeRolePolicyDocument necessary to give this principal // permissions to assume the given role. AddToAssumeRolePolicy(document awsiam.PolicyDocument) // Add to the policy of this principal. AddToPolicy(statement awsiam.PolicyStatement) *bool // Add to the policy of this principal. AddToPrincipalPolicy(_statement awsiam.PolicyStatement) *awsiam.AddToPrincipalPolicyResult // Return whether or not this principal is equal to the given principal. DedupeString() *string // JSON-ify the principal. // // Used when JSON.stringify() is called ToJSON() *map[string]*[]*string // Returns a string representation of an object. ToString() *string // Returns a new PrincipalWithConditions using this principal as the base, with the passed conditions added. // // When there is a value for the same operator and key in both the principal and the // conditions parameter, the value from the conditions parameter will be used. // // Returns: a new PrincipalWithConditions object. WithConditions(conditions *map[string]interface{}) awsiam.PrincipalBase // Returns a new principal using this principal as the base, with session tags enabled. // // Returns: a new SessionTagsPrincipal object. WithSessionTags() awsiam.PrincipalBase }
A principal to allow access to a key if it's being used through another AWS service.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var principal iPrincipal viaServicePrincipal := awscdk.Aws_kms.NewViaServicePrincipal(jsii.String("serviceName"), principal)
func NewViaServicePrincipal ¶
func NewViaServicePrincipal(serviceName *string, basePrincipal awsiam.IPrincipal) ViaServicePrincipal
Source Files ¶
- Alias.go
- AliasAttributes.go
- AliasProps.go
- Alias__checks.go
- CfnAlias.go
- CfnAliasProps.go
- CfnAlias__checks.go
- CfnKey.go
- CfnKeyProps.go
- CfnKey__checks.go
- CfnReplicaKey.go
- CfnReplicaKeyProps.go
- CfnReplicaKey__checks.go
- IAlias.go
- IKey.go
- IKey__checks.go
- Key.go
- KeyLookupOptions.go
- KeyProps.go
- KeySpec.go
- KeyUsage.go
- Key__checks.go
- ViaServicePrincipal.go
- ViaServicePrincipal__checks.go
- main.go