Hi Team, Could anyone please provide me inputs on how to perform “StartAssetBundleImportJob” API, it is not taking the override fields in the python code.
Thanks in Advance.
Bhuvana
Hi Team, Could anyone please provide me inputs on how to perform “StartAssetBundleImportJob” API, it is not taking the override fields in the python code.
Thanks in Advance.
Bhuvana
Hi @Bhuvaneswari - Have you seen this blogost Automate and accelerate your Amazon QuickSight asset deployments using the new APIs | AWS Big Data Blog? It’s very detailed and goes over all the actions for the bundle APIs.
If you’re having issues with Boto3 please post the command you’re executing and the error you’re receiving.
import os
import boto3
import time
def import_quickSight_bundle(region, account_id, bundle_zip_path, bundle_id):
quicksight_client = boto3.client(‘quicksight’, region_name=region)
# Start the asset bundle import job
with open(bundle_zip_path, 'rb') as file:
response = quicksight_client.start_asset_bundle_import_job(
AwsAccountId=account_id,
AssetBundleImportJobId=bundle_id,
AssetBundleImportSource={
# 'Body': 'file://{}'.format(file_list[0]) # Assuming the first file in the list is the dataset JSON
'Body': file.read()
},
FailureAction='ROLLBACK',
OverrideParameters={
'ResourceIdOverrideConfiguration': {
'PrefixForAllResources': 'ecca'
},
"DataSources": [
{
"DataSourceId": '11b6de83-9d5d-4d8d-a3ff-bf8bd335bfd1',
'Name': 'datasource1',
'DataSourceParameters': {
'RdsParameters': {
"InstanceId": 'YOUR-INSTANCE-ID',
"Database": 'YOUR-DB-ID'
},
},
'Credentials': {
'CredentialPair': {
'Username': 'YOUR-USER-NAME',
'Password': 'YOUR-RDS-PASSWORD'
},
# 'SecretArn': 'string'
}
}
],
'DataSets': [
{
'DataSetId': 'bc4f0368-3467-4c5d-873e-ef402f0966de',
'Name': 'dataset1'
},
],
'Dashboards': [
{
'DashboardId': '924af88b-30f5-4ec8-88d1-01f75c71dcb2',
'Name': 'dashboard1'
},
]
}
)
# print(f"{response}")
job_id = response['AssetBundleImportJobId']
print(f"Asset bundle import job started. Job ID: {job_id}")
# Wait for the asset bundle import job to complete
while True:
response = quicksight_client.describe_asset_bundle_import_job(
AwsAccountId=account_id,
AssetBundleImportJobId=job_id
)
print(f"{response}")
status = response['JobStatus']
print(f"Job Status: {status}")
if status == 'SUCCESSFUL':
print("QuickSight bundle import completed successfully.")
break
elif status == 'FAILED':
print("QuickSight bundle import failed.")
print(f"{response}")
error_message = response['AssetBundleImportJob']['Status']['Message']
print(f"Error Message: {error_message}")
break
elif status == 'FAILED_ROLLBACK_COMPLETED':
print("QuickSight bundle import failed.")
error_info = response['Errors'][0]
print(f"Error: {error_info['Message']}")
break
time.sleep(10)
target_region = ‘eu-central-1’
target_account_id = ‘YOUR-ACCOUNT-ID’
bundle_zip_path= ‘scripts.zip’
bundle_id = ‘QS_BUNDLE_ID’
import_quickSight_bundle(target_region, target_account_id, bundle_zip_path, bundle_id)
This is code we are trying to export the bundle, in the code we are using override parameters and say for instance if we are adding the instance id as instanceXYZ and the bundle.zip contain datasource with instanceABC. The command is taking instanceABC. Although it should take instaceXYZ as per the override parameter.
This is the error response we are getting -
{ “Status”: 200, “JobStatus”: “FAILED_ROLLBACK_COMPLETED”, “Errors”: [ { “Arn”: “arn:aws:quicksight:eu-central-1:ACCOUNT_ID_REDACTED:datasource/99b7b873-3f0b-42fd-9d97-da7b17aa517d”, “Type”: “com.amazonaws.services.quicksight.model.InvalidParameterValueException”, “Message”: “InstanceId sample-acca-db for account ACCOUNT_ID_REDACTED is not found” } ], “Arn”: “arn:aws:quicksight:eu-central-1:ACCOUNT_ID_REDACTED:asset-bundle-import-job/ecca-import-job”, “CreatedTime”: “2023-06-26T04:59:18+05:30”, “AssetBundleImportJobId”: “ecca-import-job”, “AwsAccountId”: “ACCOUNT_ID_REDACTED”, “AssetBundleImportSource”: { “Body”: “https://quicksight-asset-bundle-import-job-eu-central-1.s3.eu-central-1.amazonaws.com/ACCOUNT_ID_REDACTED/ecca-import-job/36ad3dc6-8a55-4d05-aa67-fd28c6dc35ec/body.zip?X-Amz-Security-Token=IQoJb3JpZ2luX2VjEM3%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaDGV1LWNlbnRyYWwt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%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20230625T232930Z&X-Amz-SignedHeaders=host&X-Amz-Expires=300&X-Amz-Credential=ASIAZM5BTPVK4EY4C7M4%2F20230625%2Feu-central-1%2Fs3%2Faws4_request&X-Amz-Signature=d0cc7e6f33745e72e83f74576e935292e50510267b39d28bbddb91df6f0e61a1” }, “OverrideParameters”: { “DataSources”: [ { “DataSourceId”: “11b6de83-9d5d-4d8d-a3ff-bf8bd335bfd1”, “DataSourceParameters”: { “RdsParameters”: { “InstanceId”: “itco2”, “Database”: “itco2_db” } } } ] }, “FailureAction”: “ROLLBACK”, “RequestId”: “4a861bdd-c1fc-4db9-8e4c-beaf223f2c33” }
Just so I’m clear, there is an Analysis with a DataSet that uses a connection to RDS. You are exporting the assets using the bundle APIs. Then you want to import them to the new account and override the RdsParameters with new values, correct?
I can try this in my environment, just need to understand the use case.
PS: I redacted your AWS account id from the post above.
Yes that is what we are trying to do
Thank you for redacting the account id
A couple of clarifications to the OverrideParameters:
We tried that out and it took the parameters and for letting you know our database behind private subnet in a VPC. this is the error we are facing now.
{ “Status”: 200, “JobStatus”: “FAILED_ROLLBACK_COMPLETED”, “Errors”: [ { “Arn”: “arn:aws:quicksight:eu-central-1:accnt_id:datasource/99b7b873-3f0b-42fd-9d97-da7b17aa517d”, “Type”: “TIMEOUT”, “Message”: “Connection to the data source timed out before validation is complete.” } ], “Arn”: “arn:aws:quicksight:eu-central-1:accnt_id:asset-bundle-import-job/ecca-import-job”, “CreatedTime”: “2023-07-06T12:06:40+05:30”, “AssetBundleImportJobId”: “ecca-import-job”, “AwsAccountId”: “xxxxxxx”, “AssetBundleImportSource”: { “Body”: “https://quicksight-asset-bundle-import-job-eu-central-1.s3.eu-central-1.amazonaws.com/accnt_id/ecca-import-job/1f38ea56-ed9f-475b-8d02-5e5d5730ae0c/body.zip?X-Amz-Security-Token=IQoJb3JpZ2luX2VjEMX%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwE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IJ6I5lastSjwfx6pL3FkJq3KOI%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20230706T063936Z&X-Amz-SignedHeaders=host&X-Amz-Expires=300&X-Amz-Credential=ASIAZM5BTPVK3RSVSSB5%2F20230706%2Feu-central-1%2Fs3%2Faws4_request&X-Amz-Signature=c65b8593f903748f657aa30271d333cedb34ba9ba7fb7349697b9dd09d03cc79” }, “OverrideParameters”: { “DataSources”: [ { “DataSourceId”: “99b7b873-3f0b-42fd-9d97-da7b17aa517d”, “DataSourceParameters”: { “RdsParameters”: { “InstanceId”: “itco2”, “Database”: “itco2_db” } }, “VpcConnectionProperties”: { “VpcConnectionArn”: “arn:aws:quicksight:eu-central-1:accnt_id:vpcConnection/ecca-vpc-connection” }, “Credentials”: {} } ] }, “FailureAction”: “ROLLBACK”, “RequestId”: “07bcd86f-eb18-4c51-a10c-a6f161a4ad9d” }
The last error I found was “The authentication type 10 is not supported. Check that you have configured the pg_hba.conf file to include the client’s IP address or subnet, and that it is using an authentication scheme supported by the driver.”
It might be related to this. “Quicksight does not support aurora-postgresql14”