嗨,我目前有一个任务定义资源,例如:
WebServerTaskDefinition:
Type: AWS::ECS::TaskDefinition
Properties:
Family: !Ref TaskDefinitionName
NetworkMode: awsvpc
RequiresCompatibilities:
- FARGATE
Cpu: !Ref TaskDefinitionCPU
Memory: !Ref TaskDefinitionMemory
ExecutionRoleArn: !Ref TaskDefinitionExecutionRole
ContainerDefinitions:
- Name: !Ref ContainerName
Image: !Ref ContainerImage
Essential: true
Cpu: 256
EntryPoint: sh,-c
Command:
PortMappings:
- ContainerPort: !Ref ContainerPort
我想定义ContainerDefinitions
Command
为
/bin/sh -c "echo '<html> <head> <title>Amazon ECS Sample App</title> <style>body {margin-top: 40px; background-color: #333;} </style> </head><body> <div style=color:white;text-align:center> <h1>Amazon ECS Sample App</h1> <h2>Congratulations!</h2> <p>Your application is now running on a container in Amazon ECS.</p> </div></body></html>' > /usr/local/apache2/htdocs/index.html && httpd-foreground"
有什么建议如何将其放入 yaml 中?如果我将命令直接放在模板中,我会收到模板格式错误