【发布时间】:2023-01-13 06:08:13
【问题描述】:
我有一个 s3 存储桶,它在 CDK 中创建时上传清单文件。
Quicksight 中的数据集随后会使用此清单文件。但是我的 CDK 部署失败了,因为 QuickSight 无法找到 S3 中的清单文件。所以我想为 Quicksight 资源添加一个 dependsOn。
const quicksightBucket = new s3.Bucket(this, "userS3Bucket", {
bucketName: "quicksight-bucket-user",
blockPublicAccess: s3.BlockPublicAccess.BLOCK_ALL,
versioned: true,
removalPolicy: cdk.RemovalPolicy.DESTROY,
autoDeleteObjects: true,
})
const bucketDeployment = new s3deploy.BucketDeployment(
this,
"bucketDeployment",
{
destinationBucket: quicksightBucket,
sources: [
s3deploy.Source.asset("/Users/user/Downloads/housing"),
],
}
)
const quicksightDatasource = new quicksight.CfnDataSource(
this,
"quicksight-datasource",
{
name: "quicksightdatasource",
awsAccountId: "123123",
dataSourceId: "7217623409123897423687",
type: "S3",
dataSourceParameters: {
s3Parameters: {
manifestFileLocation: {
bucket: quicksightBucket.bucketName,
key: "manifest.json",
},
},
},
}
)
quicksightDatasource.addDependsOn(bucketDeployment)
我收到类似这样的错误:Argument of type 'Bucket' is not assignable to parameter of type 'CfnResource'。
【问题讨论】:
标签: amazon-web-services amazon-s3 amazon-cloudformation aws-cdk