# Automating asset-bundle export

**URL:** <https://community.amazonquick.com/t/automating-asset-bundle-export/20651>\
**Category:** Q&A\
**Tags:** Boto3, developer, quick-sight\
**Created:** [November 1, 2023, 6:10am UTC](https://community.amazonquick.com/t/automating-asset-bundle-export/20651 "2023-11-01T06:10:53Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![prantika\_sinha](https://d2orw1595917va.cloudfront.net/user_avatar/community.amazonquick.com/prantika_sinha/32/21878_2.png) [@prantika\_sinha](https://community.amazonquick.com/u/prantika_sinha)\
**Post date:** [November 1, 2023, 6:10am UTC](https://community.amazonquick.com/t/automating-asset-bundle-export/20651/1 "2023-11-01T06:10:53Z")

</div>

Hi,

Our team is trying to automate asset-bundle migration using boto3. We have been able to export the asset bundle, post this we are able to download the bundle from the presigned url.

However, we are unable to upload it to s3. I need help with 2 queries here:

1. Is there a way we directly put the bundle object in s3 from the presigned url instead of downloading to local machine?
2. What could be the possible issue with put object in s3?  
Error message : upload failed: .\quicksight\_bundle.qs to s3:////quicksight\_bundle.qs An error occurred (InvalidAccessKeyId) when calling the PutObject operation: The AWS Access Key Id you provided does not exist in our records.  
Error copying the asset bundle to S3: Command ‘aws s3 cp quicksight\_bundle.qs s3:////quicksight\_bundle.qs’ returned non-zero exit status 1.

Thanks,  
Prantika

---

<div class="post-metadata">

**Author:** ![WLS-DM](https://d2orw1595917va.cloudfront.net/user_avatar/community.amazonquick.com/wls-dm/32/36109_2.png) [@WLS-DM](https://community.amazonquick.com/u/WLS-DM)\
**Post date:** [November 1, 2023, 10:55pm UTC](https://community.amazonquick.com/t/automating-asset-bundle-export/20651/2 "2023-11-01T22:55:45Z")

</div>

Hello @prantika_sinha, [here is some documentation](https://docs.aws.amazon.com/quicksight/latest/developerguide/assetbundle-import.html) that includes an example about downloading the asset-bundle directly to S3.

Are your S3 bucket and the QS account you are migrating from in the same AWS account. You may be using the wrong Access Key for your destination bucket.

---

<div class="post-metadata">

**Author:** ![prantika\_sinha](https://d2orw1595917va.cloudfront.net/user_avatar/community.amazonquick.com/prantika_sinha/32/21878_2.png) [@prantika\_sinha](https://community.amazonquick.com/u/prantika_sinha)\
**Post date:** [November 2, 2023, 2:17pm UTC](https://community.amazonquick.com/t/automating-asset-bundle-export/20651/3 "2023-11-02T14:17:34Z")

</div>

Hi Dylan,

Appreciate the response. Yes, the S3 bucket and QS account is in same AWS account for the code trial I am running. However, in the ideal scenario we need to upload it in the s3 bucket of the target account.

Also the link you shared take me to the import job, which is next step to the bundle upload in S3. Let me know if I am missing something here.

Thanks.

---

<div class="post-metadata">

**Author:** ![WLS-DM](https://d2orw1595917va.cloudfront.net/user_avatar/community.amazonquick.com/wls-dm/32/36109_2.png) [@WLS-DM](https://community.amazonquick.com/u/WLS-DM)\
**Post date:** [November 2, 2023, 3:15pm UTC](https://community.amazonquick.com/t/automating-asset-bundle-export/20651/4 "2023-11-02T15:15:09Z")

</div>

Hello @prantika_sinha, I am thinking the issue is with the presigned url and S3 bucket access. The bucket policy needs to be updated to make sure it has access to receive information from the presigned url. Plus you need to make sure your account has access to put objects in the S3 bucket. One more thing to note, the presigned url may require an expire date to be passed in with the AccessKeyIds for the Quick Sight account and S3 bucket. Here is a [link](https://docs.aws.amazon.com/AmazonS3/latest/userguide/example-bucket-policies.html) to some bucket policy documentation.

---

<div class="post-metadata">

**Author:** ![zhaopan](https://avatars.discourse-cdn.com/v4/letter/z/ebca7d/32.png) [@zhaopan](https://community.amazonquick.com/u/zhaopan)\
**Post date:** [November 2, 2023, 7:19pm UTC](https://community.amazonquick.com/t/automating-asset-bundle-export/20651/5 "2023-11-02T19:19:15Z")

</div>

No, you need to download the asset bundle file first using the pre-signed URL.

Then, you can call import API with the asset bundle file that you downloaded, without having to upload to another S3 bucket first.

If you are using awscli, you can use:  
`--asset-bundle-import-source-bytes fileb://file_name.qs`

You can do the same using the AWS SDKs.

---

<div class="post-metadata">

**Author:** ![prantika\_sinha](https://d2orw1595917va.cloudfront.net/user_avatar/community.amazonquick.com/prantika_sinha/32/21878_2.png) [@prantika\_sinha](https://community.amazonquick.com/u/prantika_sinha)\
**Post date:** [November 3, 2023, 10:02am UTC](https://community.amazonquick.com/t/automating-asset-bundle-export/20651/6 "2023-11-03T10:02:49Z")

</div>

Thanks @zhaopan.  
We are trying to put a terraform script for this implementation and want to skip the download to local step. My question is more around if there is any way we can bypass this and directly put to S3.

Adding to your response @WLS-DM , the presigned url is auto generated based on the export command and the account has access to put object in S3. Both these checks are done.

---

<div class="post-metadata">

**Author:** ![zhaopan](https://avatars.discourse-cdn.com/v4/letter/z/ebca7d/32.png) [@zhaopan](https://community.amazonquick.com/u/zhaopan)\
**Post date:** [November 3, 2023, 2:28pm UTC](https://community.amazonquick.com/t/automating-asset-bundle-export/20651/7 "2023-11-03T14:28:32Z")

</div>

At the moment, no. There are a number of ways you can download file in Terraform. [remote-exec privisioner](https://developer.hashicorp.com/terraform/language/resources/provisioners/remote-exec) + `curl` seems to be the recommended method.
