diff --git a/cloudformation/Makefile b/cloudformation/Makefile index b012584..325963a 100644 --- a/cloudformation/Makefile +++ b/cloudformation/Makefile @@ -27,12 +27,14 @@ ifeq ($(ENVIRONMENT_NAME),production) DB_SECURITY_GROUP_ID=$(DB_SECURITY_GROUP_ID_PRODUCTION) CPU_SIZE=1024 MEMORY_SIZE=4GB + BERNARD_SQS_POLICY=arn:aws:iam::954747537408:policy/pw-publish-photowall-bernard-live-queue else SUBDOMAIN=$(STACK_NAME)-$(ENVIRONMENT_NAME) GITHUB_BRANCH=$(ENVIRONMENT_NAME) DB_SECURITY_GROUP_ID=$(DB_SECURITY_GROUP_ID_STAGING) CPU_SIZE=512 MEMORY_SIZE=2GB + BERNARD_SQS_POLICY=arn:aws:iam::954747537408:policy/pw-publish-photowall-bernard-stage-queue endif check-create-initial-ecr-image: @@ -72,7 +74,8 @@ create-stack: check-create-variables-set check-create-initial-ecr-image ParameterKey="GitHubBranch",ParameterValue="$(GITHUB_BRANCH)" \ ParameterKey="GitHubToken",ParameterValue="$(GITHUB_TOKEN)" \ ParameterKey="CpuSize",ParameterValue="$(CPU_SIZE)" \ - ParameterKey="MemorySize",ParameterValue="$(MEMORY_SIZE)" + ParameterKey="MemorySize",ParameterValue="$(MEMORY_SIZE)" \ + ParameterKey="BernardSQSPolicy",ParameterValue="$(BERNARD_SQS_POLICY)" update-stack: $(call checkdef,STACK_NAME) @@ -89,4 +92,5 @@ update-stack: ParameterKey="GitHubBranch",UsePreviousValue=true \ ParameterKey="GitHubToken",UsePreviousValue=true \ ParameterKey="CpuSize",ParameterValue="$(CPU_SIZE)" \ - ParameterKey="MemorySize",ParameterValue="$(MEMORY_SIZE)" + ParameterKey="MemorySize",ParameterValue="$(MEMORY_SIZE)" \ + ParameterKey="BernardSQSPolicy",ParameterValue="$(BERNARD_SQS_POLICY)" diff --git a/cloudformation/ecs-service.yaml b/cloudformation/ecs-service.yaml index 8fc9d69..679f318 100644 --- a/cloudformation/ecs-service.yaml +++ b/cloudformation/ecs-service.yaml @@ -26,6 +26,9 @@ Parameters: Type: String Description: Name of env such as staging or production + BernardSQSPolicy: + Type: String + # CPU # 256 (.25 vCPU) - Available memory values: 0.5GB, 1GB, 2GB # 512 (.5 vCPU) - Available memory values: 1GB, 2GB, 3GB, 4GB @@ -158,6 +161,9 @@ Resources: Principal: Service: ecs-tasks.amazonaws.com Action: 'sts:AssumeRole' + ManagedPolicyArns: + - !Ref BernardSQSPolicy + # A role needed for auto scaling AutoScalingRole: diff --git a/fabfile.py b/fabfile.py index 9ee3bd1..6b2ed6b 100644 --- a/fabfile.py +++ b/fabfile.py @@ -12,8 +12,6 @@ def production(): env.environment = 'production' def cloudformation_update(): - if env.environment != 'staging': - abort('Only staging is deployed soo far') with lcd('./cloudformation/'): local('make update-stack ENVIRONMENT_NAME={0} STACK_NAME={1}'.format(env.environment, env.stack_name))