小编ahk*_*kam的帖子

如何获取yaml文件中的ssm参数?

我有一个 yaml 云形成文件,需要一个存储在 ssm 参数中的变量。yaml 文件是 CFT 模板。下面是示例代码,

AWSTemplateFormatVersion: 2010-09-09
Description: 'Fully Automated OT Archival Data Migration'
Parameters:
 Environment:
  Description: 'Stage type (for Tags)'
  Type: String
  Default: dev

Resources:
S3Bucket:
 Type: 'AWS::S3::Bucket'
 Properties:
  BucketName: '{{resolve:ssm:/opentext/config/automated-ot-archival-data-migration/migration.bucket.name:1}}-${Environment}'
Run Code Online (Sandbox Code Playgroud)

当我将代码上传到 AWS 控制台中的 cloudformation 时,出现错误。我想知道 ssm 参数引用是否正确。

如果您在这里发现任何问题,请告诉我。

谢谢

amazon-web-services aws-cloudformation

2
推荐指数
1
解决办法
1292
查看次数

如何从 s3 存储桶中删除空的子文件夹?

我在我的代码中执行了 2 个循环。下面是伪代码。

get the subfolder list in the bucket
Loop through every subfolders
    loop through every objects in a subfolder
        read the objects
        delete the objects (So at the end the subfolder will be empty)
    get the subfolder list again (asuming the empty subfolder also will be deleted and new subfolders can be created by someone)
Run Code Online (Sandbox Code Playgroud)

但结果我得到了一个无限循环,因为子文件夹仍然在存储桶中。所以我正在寻找一个解决方案,在删除子文件夹中的每个对象后删除它。但我找不到解决方案。请提出你的想法

下面是s3文件夹结构

??? bucket
    ??? folder-1
    ??? folder-2
    ??? folder-3
Run Code Online (Sandbox Code Playgroud)

amazon-s3 amazon-web-services

2
推荐指数
1
解决办法
28
查看次数