Я сократил код во вложенном стеке до одной строки вывода, чтобы ничего не знать в вложенный стек выдает ошибку.
class ApiGatewayNestedStack(NestedStack):
""" A nested stack to create the main API Gateway endpoints.
"""
def __init__(self, scope: Construct, id: str, parameters: dict, **kwargs):
super().__init__(scope, id, **kwargs)
print('do somthin')
Вложенный стек создается из родительского стека следующим образом.
apigateway_stack = ApiGatewayNestedStack(self, 'NestedStack', {})
После добавления вложенного кода стека я приступил к:
- cdk bootstrap
- cdk syth
- cdk deploy
Затем код передается, и конвейер кода начинает давать сбой только во время выполнение развертывания с ошибкой S3: доступ запрещен.
Настройки сегмента S3 установлены следующим образом:
- Блокировать публичный доступ: включено.
- Владение объектом: Владелец сегмента применяет правила
- Политика сегмента (см. ниже)
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Deny",
"Principal": {
"AWS": "*"
},
"Action": "s3:*",
"Resource": [
"arn:aws:s3:::bucketname",
"arn:aws:s3::: bucketname/*"
],
"Condition": {
"Bool": {
"aws:SecureTransport": "false"
}
}
}
]
}
I have tried making both the CDK assets bucket and pipeline buckets public accessible. I figured that if public, then anyone could access them and the error would go away, but to no avail.
I have also tried removing the Bucket Policy and changing the Object Ownership to 'Object writer', again not making any difference.
Again, when the nested stack instantiation is removed from the parent stack the pipeline will build and deploy successfully.
Подробнее здесь: https://stackoverflow.com/questions/793 ... ess-denied
Мобильная версия