Context / Client / update_connection
update_connection¶
- Context.Client.update_connection(**kwargs)¶
Updates a connection’s configuration.
See also: AWS API Documentation
Request Syntax
response = client.update_connection( connectionId='string', name='string', scope={ 'selectors': [ { 'path': [ { 'level': 'string', 'id': 'string' }, ] }, ] }, accessConfig={ 'iamRole': { 'roleArn': 'string' } }, syncSchedule={ 'frequency': 'HOURLY'|'DAILY'|'WEEKLY'|'MONTHLY', 'cronExpression': 'string' }, ingestionConfig={ 'roleArn': 'string' }, glueConnectionMappings=[ { 'path': [ { 'level': 'string', 'id': 'string' }, ], 'glueConnectionArn': 'string' }, ], publish=True|False )
- Parameters:
connectionId (string) –
[REQUIRED]
The connection to update, by its ID (which starts with
conn-) or its ARN.name (string) – The new name. If you omit it, the name is unchanged.
scope (dict) –
The new ingestion scope for the connection. If you omit it, the existing scope is unchanged. The rules of
CreateConnectionRequest.scopeapply, with the following additions:A
DATABRICKSorSNOWFLAKEscope names at most onedatabricksCatalogorsnowflakeDatabase, unless the existing scope already names each one.If the stored scope has a selector with a
glueServicesegment, the new scope can’t be empty. Every selector that it adds must also have aglueServicesegment. Otherwise, the request fails withValidationException. You can keep a selector that the stored scope already has, so resending the stored scope unchanged succeeds.
selectors (list) –
The selectors describing which parts of the data source are in scope.
(dict) –
A single selector: an ordered path of
{level, id}segments identifying a node in the data source’s resource hierarchy. On a GLUE_DATA_CATALOG connection the path can also name at most oneglueServicesegment, which selects a service rather than a node (seeDataSourceScope).path (list) – [REQUIRED]
Ordered hierarchy path from the root to the selected resource. Must be non-empty.
(dict) –
One segment of a resource hierarchy path: the hierarchy
level, such asdatabaseortable, and theidof the resource at that level. Both are required.In a
GLUE_DATA_CATALOGconnection’s scope, the levelglueServicenames a service instead of a resource. Itsidis one of the following:GLUE- AWS Glue databases and tables.SAGEMAKER_AI- Amazon SageMaker AI resources.REDSHIFT- Amazon Redshift resources.RDS- Amazon RDS resources.MSK- Amazon Managed Streaming for Apache Kafka (Amazon MSK) resources.KINESIS- Amazon Kinesis Data Streams resources.FIREHOSE- Amazon Data Firehose resources.DYNAMODB- Amazon DynamoDB resources.KEYSPACES- Amazon Keyspaces (for Apache Cassandra) resources.ELASTICACHE- Amazon ElastiCache resources.OPENSEARCH- Amazon OpenSearch Service resources.NEPTUNE- Amazon Neptune resources.TIMESTREAM- Amazon Timestream resources.ATHENA- Amazon Athena resources.GLUE_SCHEMA_REGISTRY- AWS Glue Schema Registry resources.S3- Amazon S3 resources.S3_VECTORS- Amazon S3 Vectors resources.
Every later segment of the selector must name a level of that service. Any other value, a second
glueServicesegment, or aglueServicesegment in any other position returnsValidationException. A resource path never containsglueService.level (string) – [REQUIRED]
The hierarchy level name for this segment (for example, “database”, “table”). Non-blank, no whitespace.
id (string) – [REQUIRED]
The ID of the resource at this level. Non-blank. Can contain spaces, backticks, and
%(it is a resource name), but no control characters. AWS Context matches it exactly.
accessConfig (dict) –
The updated access configuration for the data source. If you omit it, the existing configuration is unchanged. If you provide one, it replaces the stored configuration, including its variant.
For
DATABRICKSandSNOWFLAKE, a configuration with no variant clears a storediamRole, and the connection is then returned with noaccessConfig.For
GLUE_DATA_CATALOGandBEDROCK_KNOWLEDGE_BASE, you cannot add or remove theiamRole. An update that adds aniamRoleto a connection stored without one fails withValidationException. So does an update that provides a configuration withoutiamRolefor a connection that has one. You can replace a stored role with another role. To change how such a connection reads its data source, delete the connection and create it again.Note
This is a Tagged Union structure. Only one of the following top level keys can be set:
iamRole.iamRole (dict) –
Assume-role access. The service assumes
roleArnto read the connection’s data source.roleArn (string) – [REQUIRED]
The IAM role that AWS Context assumes to read this connection’s data source. The role must be in your account. AWS Context rejects a role in another account. It has the same format as
ingestionConfig.roleArn. You must haveiam:PassRolepermission on the role to pass it to AWS Context. Otherwise, CreateConnection and UpdateConnection fail withAccessDeniedException.
syncSchedule (dict) –
The new sync schedule for a
DATABRICKSorSNOWFLAKEsource. If you omit it, the existing schedule is unchanged. Not accepted forGLUE_DATA_CATALOGandBEDROCK_KNOWLEDGE_BASEconnections.Note
This is a Tagged Union structure. Only one of the following top level keys can be set:
frequency,cronExpression.frequency (string) –
How often catalog synchronization runs. AWS Glue determines the schedule’s start time. Valid values:
HOURLY- Every 60 minutes.DAILY- Every 1,440 minutes.WEEKLY- Not supported. You can save this value on a connection created withpublishset tofalse, but publishing the connection with this value returnsValidationException.MONTHLY- Not supported. You can save this value on a connection created withpublishset tofalse, but publishing the connection with this value returnsValidationException.
cronExpression (string) –
Not supported. Catalog synchronization doesn’t support cron schedules, so publishing a connection with this member returns
ValidationException. Usefrequencyinstead.
ingestionConfig (dict) –
[REQUIRED]
The ingestion configuration: the IAM role that a data producer assumes to push data into this connection. Required on every update, so that an existing connection always has an ingestion role that AWS Context can authorize. You must have
iam:PassRolepermission to pass this role to the data producer, and the role must be in your account. You can’t clear the role.roleArn (string) – [REQUIRED]
The IAM role in your account that a data producer assumes to push data into this connection’s agent contexts. Your account must own the role.
glueConnectionMappings (list) –
The AWS Glue connection for each
redshiftNamespace, and for eachrdsInstanceandrdsDatabasepair, inscope. If you omit it, the stored list is kept. A list replaces the stored list, and an empty list clears it. If the update changesscope, or changes the role of a connection to another account’s catalog, AWS Context validates the kept list again. The rules are those ofCreateConnectionRequest.glueConnectionMappings. You can’t change the list of aSNOWFLAKEconnection, which is keyed bysnowflakeDatabase: omit it or send it unchanged.(dict) –
A GlueConnectionMapping binds one resource in the connection’s
scopeto an existing AWS Glue connection that you specify for it. The mapping covers every scope selector that names that resource. For aredshiftNamespace, AWS Context does not check which resource your AWS Glue connection targets. AWS Context does not revalidate an update that resends the stored list unchanged. A response does not return a status for each mapping.path (list) – [REQUIRED]
The resource that this mapping binds, root first, in the same form as
scope.selectors[].path. Required. Contains 1–2 segments:On a
GLUE_DATA_CATALOGconnection, either aredshiftNamespacesegment whose ID is an Amazon Redshift namespace ARN (namespace:<id>, ornamespace/<id>for Amazon Redshift Serverless), or anrdsInstancesegment whose ID is an Amazon RDS DB cluster or DB instance ARN (cluster:<id>ordb:<id>) followed by anrdsDatabasesegment whose ID is the database name. The ARN must be in your account and Region.On a
SNOWFLAKEconnection whosedataSourceis an AWS Glue connection, asnowflakeDatabasesegment whose ID is the database name, at most 255 characters.
(dict) –
One segment of a resource hierarchy path: the hierarchy
level, such asdatabaseortable, and theidof the resource at that level. Both are required.In a
GLUE_DATA_CATALOGconnection’s scope, the levelglueServicenames a service instead of a resource. Itsidis one of the following:GLUE- AWS Glue databases and tables.SAGEMAKER_AI- Amazon SageMaker AI resources.REDSHIFT- Amazon Redshift resources.RDS- Amazon RDS resources.MSK- Amazon Managed Streaming for Apache Kafka (Amazon MSK) resources.KINESIS- Amazon Kinesis Data Streams resources.FIREHOSE- Amazon Data Firehose resources.DYNAMODB- Amazon DynamoDB resources.KEYSPACES- Amazon Keyspaces (for Apache Cassandra) resources.ELASTICACHE- Amazon ElastiCache resources.OPENSEARCH- Amazon OpenSearch Service resources.NEPTUNE- Amazon Neptune resources.TIMESTREAM- Amazon Timestream resources.ATHENA- Amazon Athena resources.GLUE_SCHEMA_REGISTRY- AWS Glue Schema Registry resources.S3- Amazon S3 resources.S3_VECTORS- Amazon S3 Vectors resources.
Every later segment of the selector must name a level of that service. Any other value, a second
glueServicesegment, or aglueServicesegment in any other position returnsValidationException. A resource path never containsglueService.level (string) – [REQUIRED]
The hierarchy level name for this segment (for example, “database”, “table”). Non-blank, no whitespace.
id (string) – [REQUIRED]
The ID of the resource at this level. Non-blank. Can contain spaces, backticks, and
%(it is a resource name), but no control characters. AWS Context matches it exactly.
glueConnectionArn (string) – [REQUIRED]
The ARN of your AWS Glue connection for
path, in your account and Region. Required. The connection type must be one thatpathaccepts:redshiftNamespace- AREDSHIFTunified connection (ConnectionSchemaVersion 2).rdsInstanceandrdsDatabase- APOSTGRESQLunified connection, or, for an RDS DB instance, alsoORACLE, with itsDATABASEproperty set to thatrdsDatabase.snowflakeDatabase- ASNOWFLAKEconnection with aROLE_ARNand itsDATABASEproperty set to that database. TheROLE_ARNmust allowglue:GetConnectionon that connection.
AWS Context synchronizes the database through this connection. It doesn’t change
DATABASEon a connection that it didn’t create. If AWS Glue is still validating the connection, the request fails withConflictException. If its validation failed, the request fails withAccessDeniedException.
publish (boolean) – Specifies whether to publish a third-party connection created with
publish: false. Iftrue, AWS Context configures catalog synchronization. The connection moves to ACTIVE when AWS Glue finishes provisioning the managed crawler. This has no effect on an ACTIVE connection.falseis not accepted, because a connection can’t be unpublished. Delete the connection instead.
- Return type:
dict
- Returns:
Response Syntax
{ 'id': 'string', 'arn': 'string', 'name': 'string', 'dataSource': { 'type': 'GLUE_DATA_CATALOG'|'BEDROCK_KNOWLEDGE_BASE'|'DATABRICKS'|'SNOWFLAKE', 'location': { 'arn': 'string' } }, 'scope': { 'selectors': [ { 'path': [ { 'level': 'string', 'id': 'string' }, ] }, ] }, 'accessConfig': { 'iamRole': { 'roleArn': 'string' } }, 'syncSchedule': { 'frequency': 'HOURLY'|'DAILY'|'WEEKLY'|'MONTHLY', 'cronExpression': 'string' }, 'ingestionConfig': { 'roleArn': 'string' }, 'glueConnectionMappings': [ { 'path': [ { 'level': 'string', 'id': 'string' }, ], 'glueConnectionArn': 'string' }, ], 'status': 'CREATING'|'ACTIVE'|'UPDATING'|'DELETING'|'FAILED', 'failure': { 'code': 'GLUE_CONNECTION_UNAVAILABLE', 'message': 'string' }, 'subStatus': 'GLUE_CONNECTION_CREATED'|'GLUE_CONNECTION_VALIDATED'|'SYNC_JOB_CREATED', 'createdAt': datetime(2015, 1, 1), 'updatedAt': datetime(2015, 1, 1) }
Response Structure
(dict) –
A connection, as returned by CreateConnection, GetConnection, and UpdateConnection.
id,arn,name,dataSource,status,createdAt, andupdatedAtare always present. Every other member is optional.id (string) –
The ID of the connection.
arn (string) –
The ARN of the connection.
name (string) –
The name of the connection. You set it when you create the connection and can change it with UpdateConnection. Uses the same constraints as an agent context name. Always present.
dataSource (dict) –
The typed reference to the external data source that this connection binds to. Its
type, the authoritative kind of data source, is indataSource.type.type (string) –
The kind of data source.
Valid values:
GLUE_DATA_CATALOG- An AWS Glue Data Catalog, or an AWS Glue connection that fronts a federated AWS data source.BEDROCK_KNOWLEDGE_BASE- An Amazon Bedrock knowledge base.DATABRICKS- A Databricks third-party catalog.SNOWFLAKE- A Snowflake third-party catalog.
location (dict) –
Where the data source lives. For this scope, an AWS ARN only.
arn (string) –
The ARN of the data source. Its account segment must be your account when you create the connection.
scope (dict) –
The hierarchical subset of the data source this connection ingests.
selectors (list) –
The selectors describing which parts of the data source are in scope.
(dict) –
A single selector: an ordered path of
{level, id}segments identifying a node in the data source’s resource hierarchy. On a GLUE_DATA_CATALOG connection the path can also name at most oneglueServicesegment, which selects a service rather than a node (seeDataSourceScope).path (list) –
Ordered hierarchy path from the root to the selected resource. Must be non-empty.
(dict) –
One segment of a resource hierarchy path: the hierarchy
level, such asdatabaseortable, and theidof the resource at that level. Both are required.In a
GLUE_DATA_CATALOGconnection’s scope, the levelglueServicenames a service instead of a resource. Itsidis one of the following:GLUE- AWS Glue databases and tables.SAGEMAKER_AI- Amazon SageMaker AI resources.REDSHIFT- Amazon Redshift resources.RDS- Amazon RDS resources.MSK- Amazon Managed Streaming for Apache Kafka (Amazon MSK) resources.KINESIS- Amazon Kinesis Data Streams resources.FIREHOSE- Amazon Data Firehose resources.DYNAMODB- Amazon DynamoDB resources.KEYSPACES- Amazon Keyspaces (for Apache Cassandra) resources.ELASTICACHE- Amazon ElastiCache resources.OPENSEARCH- Amazon OpenSearch Service resources.NEPTUNE- Amazon Neptune resources.TIMESTREAM- Amazon Timestream resources.ATHENA- Amazon Athena resources.GLUE_SCHEMA_REGISTRY- AWS Glue Schema Registry resources.S3- Amazon S3 resources.S3_VECTORS- Amazon S3 Vectors resources.
Every later segment of the selector must name a level of that service. Any other value, a second
glueServicesegment, or aglueServicesegment in any other position returnsValidationException. A resource path never containsglueService.level (string) –
The hierarchy level name for this segment (for example, “database”, “table”). Non-blank, no whitespace.
id (string) –
The ID of the resource at this level. Non-blank. Can contain spaces, backticks, and
%(it is a resource name), but no control characters. AWS Context matches it exactly.
accessConfig (dict) –
Per-connection access configuration: the IAM role used for data access.
Note
This is a Tagged Union structure. Only one of the following top level keys will be set:
iamRole. If a client receives an unknown member it will setSDK_UNKNOWN_MEMBERas the top level key, which maps to the name or tag of the unknown member. The structure ofSDK_UNKNOWN_MEMBERis as follows:'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
iamRole (dict) –
Assume-role access. The service assumes
roleArnto read the connection’s data source.roleArn (string) –
The IAM role that AWS Context assumes to read this connection’s data source. The role must be in your account. AWS Context rejects a role in another account. It has the same format as
ingestionConfig.roleArn. You must haveiam:PassRolepermission on the role to pass it to AWS Context. Otherwise, CreateConnection and UpdateConnection fail withAccessDeniedException.
syncSchedule (dict) –
The effective sync schedule. Present for
DATABRICKSandSNOWFLAKEconnections (DAILYif you didn’t specify one). Absent forGLUE_DATA_CATALOGandBEDROCK_KNOWLEDGE_BASEconnections, which are event-driven.Note
This is a Tagged Union structure. Only one of the following top level keys will be set:
frequency,cronExpression. If a client receives an unknown member it will setSDK_UNKNOWN_MEMBERas the top level key, which maps to the name or tag of the unknown member. The structure ofSDK_UNKNOWN_MEMBERis as follows:'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
frequency (string) –
How often catalog synchronization runs. AWS Glue determines the schedule’s start time. Valid values:
HOURLY- Every 60 minutes.DAILY- Every 1,440 minutes.WEEKLY- Not supported. You can save this value on a connection created withpublishset tofalse, but publishing the connection with this value returnsValidationException.MONTHLY- Not supported. You can save this value on a connection created withpublishset tofalse, but publishing the connection with this value returnsValidationException.
cronExpression (string) –
Not supported. Catalog synchronization doesn’t support cron schedules, so publishing a connection with this member returns
ValidationException. Usefrequencyinstead.
ingestionConfig (dict) –
The connection’s ingestion configuration (the IAM role a data producer assumes to push into this connection). Absent when no ingestion role is configured.
roleArn (string) –
The IAM role in your account that a data producer assumes to push data into this connection’s agent contexts. Your account must own the role.
glueConnectionMappings (list) –
The AWS Glue connection for each
redshiftNamespace, eachrdsInstanceandrdsDatabasepair, or eachsnowflakeDatabaseinscope. Absent when none is configured.(dict) –
A GlueConnectionMapping binds one resource in the connection’s
scopeto an existing AWS Glue connection that you specify for it. The mapping covers every scope selector that names that resource. For aredshiftNamespace, AWS Context does not check which resource your AWS Glue connection targets. AWS Context does not revalidate an update that resends the stored list unchanged. A response does not return a status for each mapping.path (list) –
The resource that this mapping binds, root first, in the same form as
scope.selectors[].path. Required. Contains 1–2 segments:On a
GLUE_DATA_CATALOGconnection, either aredshiftNamespacesegment whose ID is an Amazon Redshift namespace ARN (namespace:<id>, ornamespace/<id>for Amazon Redshift Serverless), or anrdsInstancesegment whose ID is an Amazon RDS DB cluster or DB instance ARN (cluster:<id>ordb:<id>) followed by anrdsDatabasesegment whose ID is the database name. The ARN must be in your account and Region.On a
SNOWFLAKEconnection whosedataSourceis an AWS Glue connection, asnowflakeDatabasesegment whose ID is the database name, at most 255 characters.
(dict) –
One segment of a resource hierarchy path: the hierarchy
level, such asdatabaseortable, and theidof the resource at that level. Both are required.In a
GLUE_DATA_CATALOGconnection’s scope, the levelglueServicenames a service instead of a resource. Itsidis one of the following:GLUE- AWS Glue databases and tables.SAGEMAKER_AI- Amazon SageMaker AI resources.REDSHIFT- Amazon Redshift resources.RDS- Amazon RDS resources.MSK- Amazon Managed Streaming for Apache Kafka (Amazon MSK) resources.KINESIS- Amazon Kinesis Data Streams resources.FIREHOSE- Amazon Data Firehose resources.DYNAMODB- Amazon DynamoDB resources.KEYSPACES- Amazon Keyspaces (for Apache Cassandra) resources.ELASTICACHE- Amazon ElastiCache resources.OPENSEARCH- Amazon OpenSearch Service resources.NEPTUNE- Amazon Neptune resources.TIMESTREAM- Amazon Timestream resources.ATHENA- Amazon Athena resources.GLUE_SCHEMA_REGISTRY- AWS Glue Schema Registry resources.S3- Amazon S3 resources.S3_VECTORS- Amazon S3 Vectors resources.
Every later segment of the selector must name a level of that service. Any other value, a second
glueServicesegment, or aglueServicesegment in any other position returnsValidationException. A resource path never containsglueService.level (string) –
The hierarchy level name for this segment (for example, “database”, “table”). Non-blank, no whitespace.
id (string) –
The ID of the resource at this level. Non-blank. Can contain spaces, backticks, and
%(it is a resource name), but no control characters. AWS Context matches it exactly.
glueConnectionArn (string) –
The ARN of your AWS Glue connection for
path, in your account and Region. Required. The connection type must be one thatpathaccepts:redshiftNamespace- AREDSHIFTunified connection (ConnectionSchemaVersion 2).rdsInstanceandrdsDatabase- APOSTGRESQLunified connection, or, for an RDS DB instance, alsoORACLE, with itsDATABASEproperty set to thatrdsDatabase.snowflakeDatabase- ASNOWFLAKEconnection with aROLE_ARNand itsDATABASEproperty set to that database. TheROLE_ARNmust allowglue:GetConnectionon that connection.
AWS Context synchronizes the database through this connection. It doesn’t change
DATABASEon a connection that it didn’t create. If AWS Glue is still validating the connection, the request fails withConflictException. If its validation failed, the request fails withAccessDeniedException.
status (string) –
The connection’s status. Valid values:
CREATING- Validation or provisioning is still in progress.ACTIVE- The data source is reachable and, for aDATABRICKSorSNOWFLAKEconnection, AWS Glue has provisioned catalog synchronization and returned its crawler ARN. This doesn’t mean that a crawl has started or completed.UPDATING- The connection is being updated.DELETING- The connection is being deleted.FAILED- Validation or provisioning failed, and the connection can’t recover.
failure (dict) –
The reason the connection is FAILED. Absent in every other status.
code (string) –
A code that identifies why the connection failed. Codes include the following:
GLUE_CONNECTION_UNAVAILABLE- The AWS Glue connection failed AWS Glue validation or no longer exists, or AWS Context couldn’t provision catalog synchronization. Check the AWS Glue connection in the AWS Glue console, and then create the connection again.
New codes can be added, so handle a code that you don’t recognize. Use
code, notmessage, to decide how to respond.message (string) –
The failure message. For an AWS Glue connection that failed validation, this is the StatusReason from AWS Glue. Otherwise, it is a message from AWS Context.
subStatus (string) –
The last milestone a third-party connection’s lifecycle reached. Present in two statuses: CREATING, where it shows the resources provisioned so far, and DELETING, where it shows the resources removed so far. Absent in every other status and while nothing has been done yet in the current direction. CREATING at GLUE_CONNECTION_VALIDATED on a connection created with
publish: falsemeans it is waiting for UpdateConnectionpublish: true.createdAt (datetime) –
The date and time when the connection was created.
updatedAt (datetime) –
When the resource last changed. Equal to
createdAtuntil the first update.
Exceptions