Skip to content
v2.274.0

Catalog L2 construct ​

A Glue Data Catalog.

Use Catalog.forAccount(scope) to obtain the implicit account-wide catalog, Catalog.encryptAccount(scope, options) to configure its Data Catalog encryption, or new Catalog(...) to create an AWS::Glue::Catalog resource.

Example ​

ts
declare const key: kms.Key;
glue.Catalog.encryptAccount(this, {
  encryptionAtRest: glue.DataCatalogEncryptionAtRest.kms(key),
});
python
# key: kms.Key

glue.Catalog.encrypt_account(self,
    encryption_at_rest=glue.DataCatalogEncryptionAtRest.kms(key)
)
java
Key key;

Catalog.encryptAccount(this, CatalogEncryptionOptions.builder()
        .encryptionAtRest(DataCatalogEncryptionAtRest.kms(key))
        .build());
csharp
// Install: dotnet add package Amazon.CDK.AWS.Glue.Alpha
Key key;

Catalog.EncryptAccount(this, new CatalogEncryptionOptions {
    EncryptionAtRest = DataCatalogEncryptionAtRest.Kms(key)
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdkgluealpha/v2
var key Key

glue.Catalog_EncryptAccount(this, &CatalogEncryptionOptions{
	EncryptionAtRest: glue.DataCatalogEncryptionAtRest_Kms(key),
})

Initializer ​

ts
new Catalog(scope: Construct, id: string, props: CatalogProps)
python
Catalog(scope: Construct, id: str, props: CatalogProps)
java
new Catalog(Construct scope, String id, CatalogProps props)
csharp
new Catalog(Construct scope, string id, CatalogProps props)
go
NewCatalog(Scope Construct, Id *string, Props CatalogProps)

Construct Props ​

catalogNamestringcatalog_namestrcatalogNameStringCatalogNamestringCatalogName*stringrequired#
The name of the catalog.
connectionPasswordEncryptionConnectionPasswordEncryptionconnection_password_encryptionConnectionPasswordEncryptionconnectionPasswordEncryptionConnectionPasswordEncryptionConnectionPasswordEncryptionConnectionPasswordEncryptionConnectionPasswordEncryptionConnectionPasswordEncryption#
Connection-password encryption configuration for the catalog.

Default: connection-password encryption is not managed by CDK

descriptionstringdescriptionstrdescriptionStringDescriptionstringDescription*string#
A description of the catalog.

Default: no description

Encryption-at-rest configuration for the catalog.

Default: encryption at rest is not managed by CDK (the catalog default applies)

Properties ​

catalogArnstringcatalog_arnstrcatalogArnStringCatalogArnstringCatalogArn*stringrequired#
The ARN of the catalog.
catalogIdstringcatalog_idstrcatalogIdStringCatalogIdstringCatalogId*stringrequired#
The id of the catalog (for the account-wide catalog, the AWS account id).
catalogRefCatalogReferencecatalog_refCatalogReferencecatalogRefCatalogReferenceCatalogRefCatalogReferenceCatalogRefCatalogReferencerequired#
A reference to a Catalog resource.
connectionPasswordKeyIKeyRefconnection_password_keyIKeyRefconnectionPasswordKeyIKeyRefConnectionPasswordKeyIKeyRefConnectionPasswordKeyIKeyRef#
The customer-managed KMS key used to encrypt connection passwords, if one was configured.

Undefined when password encryption uses an AWS-managed key or is not configured. Grant access to it via KeyGrants, e.g. if (catalog.connectionPasswordKey) { KeyGrants.fromKey(catalog.connectionPasswordKey).encrypt(grantee); }.

encryptionKeyIKeyRefencryption_keyIKeyRefencryptionKeyIKeyRefEncryptionKeyIKeyRefEncryptionKeyIKeyRef#
The customer-managed KMS key used for the catalog's encryption at rest, if one was configured.

Undefined when encryption is disabled or an AWS-managed key is used. Grant access to it via KeyGrants, e.g. if (catalog.encryptionKey) { KeyGrants.fromKey(catalog.encryptionKey).encrypt(grantee); }.

The environment this resource belongs to.
notes

For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.

For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.

nodeNodenodeNodenodeNodeNodeNodeNodeNoderequired#
The tree node.
PROPERTY_INJECTION_IDstringproperty_injection_idstrPROPERTY_INJECTION_IDStringPROPERTY_INJECTION_IDstringPROPERTY_INJECTION_ID*stringrequiredstatic#
Uniquely identifies this class.
stackStackstackStackstackStackStackStackStackStackrequired#
The stack in which this resource is defined.

Methods ​

applyCrossStackReferenceStrength(strength: ReferenceStrength): voiddef apply_cross_stack_reference_strength(self, strength: ReferenceStrength) -> Nonepublic void applyCrossStackReferenceStrength(ReferenceStrength strength)public void ApplyCrossStackReferenceStrength(ReferenceStrength strength)func ApplyCrossStackReferenceStrength(Strength ReferenceStrength)#
Override the cross-stack reference strength for this resource.
notes · 1 parameter

When set, any cross-stack reference to this resource will use the specified mechanism instead of the global default determined by the @aws-cdk/core:defaultCrossStackReferences context key. This is useful for selectively weakening specific references to avoid the "deadly embrace" problem without changing the app-wide default.

Parameters

  • strengthstrengthstrengthstrengthStrength — - The reference strength to use for this resource.
applyRemovalPolicy(policy: RemovalPolicy): voiddef apply_removal_policy(self, policy: RemovalPolicy) -> Nonepublic void applyRemovalPolicy(RemovalPolicy policy)public void ApplyRemovalPolicy(RemovalPolicy policy)func ApplyRemovalPolicy(Policy RemovalPolicy)#
Apply the given removal policy to this resource.
notes

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).

encryptAccount(scope: Construct, options: CatalogEncryptionOptions): ICatalog@staticmethod def encrypt_account(scope: Construct, options: CatalogEncryptionOptions) -> ICatalogpublic static ICatalog encryptAccount(Construct scope, CatalogEncryptionOptions options)public static ICatalog EncryptAccount(Construct scope, CatalogEncryptionOptions options)func EncryptAccount(Scope Construct, Options CatalogEncryptionOptions) ICatalogstatic#
Configure Data Catalog encryption for the implicit, account-wide catalog and return it.
notes

The account catalog's encryption is an account/region-wide setting, managed through the singleton PutDataCatalogEncryptionSettings API. Because encryption is fixed at construction, it must be configured before the account catalog is first used in the stack: calling this after the account catalog has already been materialized (for example by Catalog.forAccount, or by a Database that uses the account catalog) throws.

Configure it in exactly one stack. Configuring it from multiple stacks in the same account and region makes those stacks overwrite one another at deploy time, and the result is order-dependent. Unlike duplicate settings within a single stack (which CloudFormation rejects), this cross-stack conflict is not caught at synthesis time, because each stack synthesizes to its own template.

forAccount(scope: Construct): ICatalog@staticmethod def for_account(scope: Construct) -> ICatalogpublic static ICatalog forAccount(Construct scope)public static ICatalog ForAccount(Construct scope)func ForAccount(Scope Construct) ICatalogstatic#
Obtain the implicit, account-wide Data Catalog.
notes

The account catalog is not a CloudFormation resource; it always exists. This returns a stack-scoped singleton, so repeated calls within the same stack return the same instance.

This returns the account catalog without managing its encryption. To configure Data Catalog encryption for the account, use Catalog.encryptAccount(scope, options) instead - it must be called before the account catalog is first used in the stack.

fromCatalogArn(scope: Construct, id: string, catalogArn: string): ICatalog@staticmethod def from_catalog_arn(scope: Construct, id: str, catalog_arn: str) -> ICatalogpublic static ICatalog fromCatalogArn(Construct scope, String id, String catalogArn)public static ICatalog FromCatalogArn(Construct scope, string id, string catalogArn)func FromCatalogArn(Scope Construct, Id *string, CatalogArn *string) ICatalogstatic#
Import an existing catalog by its ARN.
notes

The ARN must be a Glue catalog ARN, either the account-wide catalog (arn:aws:glue:<region>:<account>:catalog, whose id is the account) or a named catalog (arn:aws:glue:<region>:<account>:catalog/<name>, whose id is the name).

The imported catalog is a pure identity handle and does not manage the catalog's encryption. To manage an existing catalog's Data Catalog encryption, add a CfnDataCatalogEncryptionSettings resource targeting its id.

fromCatalogId(scope: Construct, id: string, catalogId: string): ICatalog@staticmethod def from_catalog_id(scope: Construct, id: str, catalog_id: str) -> ICatalogpublic static ICatalog fromCatalogId(Construct scope, String id, String catalogId)public static ICatalog FromCatalogId(Construct scope, string id, string catalogId)func FromCatalogId(Scope Construct, Id *string, CatalogId *string) ICatalogstatic#
Import an existing catalog by its id.

The imported catalog is a pure identity handle and does not manage the catalog's encryption. To manage an existing catalog's Data Catalog encryption, add a CfnDataCatalogEncryptionSettings resource targeting its id.

isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#
Checks if `x` is a construct.
notes · 1 parameter · returns

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.

Parameters

  • xxxxX — Any object.

Returns: true if x is an object created from a class which extends Construct.

isOwnedResource(construct: IConstruct): boolean@staticmethod def is_owned_resource(construct: IConstruct) -> boolpublic static Boolean isOwnedResource(IConstruct construct)public static bool IsOwnedResource(IConstruct construct)func IsOwnedResource(Construct IConstruct) *boolstatic#
Returns true if the construct was created by CDK, and false otherwise.
isResource(construct: IConstruct): boolean@staticmethod def is_resource(construct: IConstruct) -> boolpublic static Boolean isResource(IConstruct construct)public static bool IsResource(IConstruct construct)func IsResource(Construct IConstruct) *boolstatic#
Check whether the given construct is a Resource.
toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#
Returns a string representation of this construct.
with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#
Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.