以下是一个示例变量替换环境:
Resources:
IndexBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: mywebsitename.com
PublicAccessBlockConfiguration:
BlockPublicAcls: true
BlockPublicPolicy: true
IgnorePublicAcls: true
RestrictPublicBuckets: true
WebsiteConfiguration:
IndexDocument: index.html
DockerHost:
Type: AWS::ECS::Cluster
TaskDefinition:
Type: AWS::ECS::TaskDefinition
Properties:
ContainerDefinitions:
- Name: website-container
Image: mywebsitename.com
Essential: true
PortMappings:
- ContainerPort: 80
Cpu: 1024
Memory: 2048
TaskRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal:
Service: ecs-tasks.amazonaws.com
Action: sts:AssumeRole
Policies:
- PolicyName: allow-s3-list-bucket
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Action:
- s3:ListBucket
- s3:GetBucketWebsite
- s3:GetObject
Resource:
- !Sub 'arn:aws:s3:::${IndexBucket}'