Init CodeCommit存储库,使用CDK存储在S3中的种子代码
我正在尝试转换用于建立模型,培训和部署的MLOP模板 cloudformation 模板模板 to cdk项目,因此我可以轻松地更新定义,合成模板并将其上传到< em> CloudCatalog 为了用作 sagemaker Studio 的项目模板。
不过,我是CDK的新手,并且尝试使用SageMaker Pipeline seed-code
存储在 s3 s3 < s3 < /em>,在原始模板中完成如下:
'ModelBuildCodeCommitRepository':
'Type': 'AWS::CodeCommit::Repository'
'Properties':
'RepositoryName':
'Fn::Sub': 'sagemaker-${SageMakerProjectName}-${SageMakerProjectId}-modelbuild'
'RepositoryDescription':
'Fn::Sub': 'SageMaker Model building workflow infrastructure as code for the
Project ${SageMakerProjectName}'
'Code':
'S3':
'Bucket': 'sagemaker-servicecatalog-seedcode-sa-east-1'
'Key': 'toolchain/model-building-workflow-v1.0.zip'
'BranchName': 'main'
CDK API文档确实是指code
参数 codecommit.repository 作为初始化选项,但仅用于压缩和上传的本地文件到 s3 等。那是因为它假设了CDK项目的部署,但是我只希望由cdk Synth
生成的模板。
当然,我总是可以使用 codecommit.cfnrepository 及其代码
参数要指向 s3 ,但随后我无法将其插入codepipeline
's中阶段's 存储库
参数,因为它期望irepository
对象。
我也想坚持aws-cdk-lib.aws_codepipeline
以掌握 cloudpipeline 的基本逻辑(我也很新),避免使用高级<代码> aws-cdk-lib.pipelines 。
关于如何实现这一目标的任何想法?
I'm trying to convert the MLOps template for model building, training, and deployment CloudFormation template into a CDK project so I can easily update the definitions, synth the template and upload it into CloudCatalog in order to be used as a project template in SageMaker Studio.
I'm quite new to CDK though, and I'm having some troubles trying to initialize a CodeCommit repository with the sagemaker pipeline seed-code
stored in S3, which was accomplished as follows in the original template :
'ModelBuildCodeCommitRepository':
'Type': 'AWS::CodeCommit::Repository'
'Properties':
'RepositoryName':
'Fn::Sub': 'sagemaker-${SageMakerProjectName}-${SageMakerProjectId}-modelbuild'
'RepositoryDescription':
'Fn::Sub': 'SageMaker Model building workflow infrastructure as code for the
Project ${SageMakerProjectName}'
'Code':
'S3':
'Bucket': 'sagemaker-servicecatalog-seedcode-sa-east-1'
'Key': 'toolchain/model-building-workflow-v1.0.zip'
'BranchName': 'main'
The CDK API docs does refer to the code
parameter in codecommit.Repository as an initialization option, but it's only for local files being compressed and uploaded to S3 and such. That's because it assumes a deployment of the CDK project, but I only want the template generated by cdk synth
.
Of course I can always use codecommit.CfnRepository and its code
parameter to point into S3, but then I cannot insert it in the codepipeline
's stage codepipeline_actions.CodeCommitSourceAction's repository
parameter because it expects an IRepository
object.
I also want to stick to aws-cdk-lib.aws_codepipeline
to grasp the fundamental logic of CloudPipeline (which I'm quite new too) and avoid using the high level aws-cdk-lib.pipelines
.
Any ideas on how can I accomplish this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
构建一个
存储库
没有代码
prop。获取 secave Hatch 引用其L1cfnrepository
层。将cfnrepository
的属性手动设置为现有的S3存储桶:以上代码将在OP中综合YAML输出。通过
repo
作为管道的源操作。不要忘记在S3存储桶上授予必要的IAM许可。
Construct a
Repository
without aCode
prop. Get an escape hatch reference to its L1CfnRepository
layer. Set theCfnRepository
's property manually to the existing S3 bucket:The above code will synth the YAML output in the OP. Pass
repo
as the pipeline's source action.Don't forget to grant the necessary IAM permissions on the S3 bucket.