SHARE
TWEET

Untitled

a guest Jan 29th, 2020 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Resources:
  2.     Repository:
  3.         Type: AWS::ECR::Repository
  4.         Properties:
  5.             RepositoryName: paas-monitor
  6.  
  7.     ExecutionRole:
  8.         Type: AWS::IAM::Role
  9.         Properties:
  10.             AssumeRolePolicyDocument:
  11.                 Version: 2012-10-17
  12.                 Statement:
  13.                     - Effect: Allow
  14.                       Principal:
  15.                         Service:
  16.                        - ecs-tasks.amazonaws.com
  17.                       Action:
  18.                       - 'sts:AssumeRole'
  19.             ManagedPolicyArns:
  20.             - arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy          
  21.  
  22.     Cluster:
  23.       Type: AWS::ECS::Cluster
  24.       Properties:
  25.         ClusterName: awslabs-cluster
  26.  
  27.     TaskDefinition:
  28.         Type: AWS::ECS::TaskDefinition
  29.         Properties:
  30.             Family: 'paas-monitor'
  31.             Cpu: 256
  32.             Memory: 512
  33.             NetworkMode: 'awsvpc'
  34.             RequiresCompatibilities:
  35.            - FARGATE
  36.             ContainerDefinitions:
  37.               - Name: 'paas-monitor'
  38.                 Image: !Sub '${AWS::AccountId}.dkr.ecr.${AWS::Region}.amazonaws.com/${Repository}:latest'
  39.                 Cpu: 256
  40.                 Memory: 512
  41.                 PortMappings:
  42.                 - ContainerPort: 1337
  43.                   HostPort: 1337      
  44.             ExecutionRoleArn: !Ref ExecutionRole
  45.  
  46.     SecurityGroup:
  47.       Type: AWS::EC2::SecurityGroup
  48.       Properties:
  49.         VpcId: vpc-0b3f586ef04a0cf57
  50.         GroupDescription: 'public access to paas-monitor'
  51.         SecurityGroupIngress:
  52.         - Description: 'open to the world'
  53.           FromPort: 1337
  54.           ToPort: 1337
  55.           IpProtocol: 'tcp'
  56.           CidrIp: '0.0.0.0/0'        
  57.  
  58.     Service:
  59.       Type: AWS::ECS::Service
  60.       Properties:
  61.         Cluster: !Ref Cluster
  62.         ServiceName: 'paas-monitor'
  63.         TaskDefinition: !Ref 'TaskDefinition'
  64.         DesiredCount: 1
  65.         LaunchType: 'FARGATE'
  66.         NetworkConfiguration:
  67.           AwsvpcConfiguration:
  68.             Subnets:
  69.               - subnet-019f45ae5d764862e
  70.               - subnet-0acf5eef5c3a9e812
  71.               - subnet-0300609d63deee18e
  72.             SecurityGroups:
  73.              - !Ref SecurityGroup
  74.             AssignPublicIp: 'ENABLED'
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top