【发布时间】:2019-07-10 14:23:43
【问题描述】:
我在运行 codedeploy 时收到此错误
这是我的 appspec.yaml 文件
version: 0.0
Resources:
- TargetService:
Type: AWS::ECS::Service
Properties:
TaskDefinition: "arn:aws:ecs:ap-southeast-1:xxx:task-definition/xxxx-def:latest"
LoadBalancerInfo:
ContainerName: "yyyyy"
ContainerPort: 80
# Optional properties
PlatformVersion: "LATEST"
NetworkConfiguration:
AwsvpcConfiguration:
Subnets: ["subnet-xxx","subnet-yyy"]
SecurityGroups: ["sg-zzz"]
Hooks:
- BeforeInstall: "drush-updb"
这就是 drush-updb 在 AWS lambda 中所做的事情
def lambda_handler(event,context):
client = boto3.client('ecs')
response = client.run_task(
overrides={
'containerOverrides': [
{
'name': 'AAA-BBB',
'command': [
"ccdd"
],
}
]
}
)
return {
'statusCode': 200,
'body': str(response)
}
最后是运行代码部署的 IAM。
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"ecs:DescribeServices",
"ecs:CreateTaskSet",
"ecs:UpdateServicePrimaryTaskSet",
"ecs:DeleteTaskSet",
"elasticloadbalancing:DescribeTargetGroups",
"elasticloadbalancing:DescribeListeners",
"elasticloadbalancing:ModifyListener",
"elasticloadbalancing:DescribeRules",
"elasticloadbalancing:ModifyRule",
"lambda:InvokeFunction",
"cloudwatch:DescribeAlarms",
"sns:Publish",
"s3:*"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"iam:PassRole"
],
"Effect": "Allow",
"Resource": "*",
"Condition": {
"StringLike": {
"iam:PassedToService": [
"ecs-tasks.amazonaws.com"
]
}
}
}
]
}
我确实有一个基于此link 的返回回调的状态代码,但它似乎不起作用。那么 codedeploy 接受什么样的回调呢?
【问题讨论】:
标签: aws-lambda amazon-iam aws-code-deploy