Skip to content

Commit

Permalink
Merge branch 'dev' into fargate-spot
Browse files Browse the repository at this point in the history
  • Loading branch information
zaro0508 committed Dec 11, 2024
2 parents 19d0cb5 + d43d719 commit ccb3787
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ jobs:
aws-deploy:
uses: "./.github/workflows/aws-deploy.yaml"
with:
role-to-assume: "arn:aws:iam::607346494281:role/sagebase-github-oidc-sage-bionetworks-it-agora-infra-v3"
role-to-assume: "arn:aws:iam::607346494281:role/sagebase-github-oidc-agora-infra-v3"
role-session-name: ${{ github.repository_owner }}-${{ github.event.repository.name }}-${{ github.run_id }}
environment: dev
2 changes: 1 addition & 1 deletion .github/workflows/deploy-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ jobs:
aws-deploy:
uses: "./.github/workflows/aws-deploy.yaml"
with:
role-to-assume: "arn:aws:iam::681175625864:role/sagebase-github-oidc-sage-bionetworks-it-agora-infra-v3"
role-to-assume: "arn:aws:iam::681175625864:role/sagebase-github-oidc-agora-infra-v3"
role-session-name: ${{ github.repository_owner }}-${{ github.event.repository.name }}-${{ github.run_id }}
environment: prod
2 changes: 1 addition & 1 deletion .github/workflows/deploy-stage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ jobs:
aws-deploy:
uses: "./.github/workflows/aws-deploy.yaml"
with:
role-to-assume: "arn:aws:iam::681175625864:role/sagebase-github-oidc-sage-bionetworks-it-agora-infra-v3"
role-to-assume: "arn:aws:iam::681175625864:role/sagebase-github-oidc-agora-infra-v3"
role-session-name: ${{ github.repository_owner }}-${{ github.event.repository.name }}-${{ github.run_id }}
environment: stage
7 changes: 5 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
ci:
autoupdate_schedule: monthly

default_language_version:
python: python3

Expand All @@ -17,7 +20,7 @@ repos:
hooks:
- id: yamllint
- repo: https://github.com/awslabs/cfn-python-lint
rev: v1.19.0
rev: v1.20.1
hooks:
- id: cfn-python-lint
args:
Expand All @@ -36,7 +39,7 @@ repos:
hooks:
- id: black
- repo: https://github.com/sirosen/check-jsonschema
rev: 0.29.4
rev: 0.30.0
hooks:
- id: check-github-workflows
- id: check-github-actions
7 changes: 6 additions & 1 deletion src/load_balancer_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,9 @@ def __init__(
self.alb = elbv2.ApplicationLoadBalancer(
self, "AppLoadBalancer", vpc=vpc, internet_facing=True
)
cdk.CfnOutput(self, "dns", value=self.alb.load_balancer_dns_name)
cdk.CfnOutput(
self,
"LoadBalancerDns",
value=self.alb.load_balancer_dns_name,
export_name=f"{construct_id}-dns",
)
23 changes: 23 additions & 0 deletions src/service_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,36 @@ def __init__(
)
)

# default ECS execution policy plus Guardduty access
execution_role = iam.Role(
self,
"ExecutionRole",
assumed_by=iam.ServicePrincipal("ecs-tasks.amazonaws.com"),
managed_policies=[
iam.ManagedPolicy.from_aws_managed_policy_name(
"service-role/AmazonECSTaskExecutionRolePolicy"
),
],
)
execution_role.add_to_policy(
iam.PolicyStatement(
actions=[
"logs:CreateLogStream",
"logs:PutLogEvents",
],
resources=["*"],
effect=iam.Effect.ALLOW,
)
)

# ECS task with fargate
self.task_definition = ecs.FargateTaskDefinition(
self,
"TaskDef",
cpu=1024,
memory_limit_mib=4096,
task_role=task_role,
execution_role=execution_role,
)

image = ecs.ContainerImage.from_registry(props.container_location)
Expand Down

0 comments on commit ccb3787

Please sign in to comment.