Skip to content

Commit

Permalink
A second attempt at fetching the upstream Nextstrain Open data from S…
Browse files Browse the repository at this point in the history
…3. Hypothesis: I need to grant my job an IAM permission to read their bucket.
  • Loading branch information
sacundim committed Apr 10, 2022
1 parent 96b4f63 commit 8de83db
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 2 deletions.
37 changes: 37 additions & 0 deletions Terraform/IAM.tf
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,43 @@ resource "aws_iam_policy" "access_to_buckets" {
})
}

resource "aws_iam_role_policy_attachment" "ecs_job_role_access_to_nextstrain_buckets" {
role = aws_iam_role.ecs_job_role.name
policy_arn = aws_iam_policy.access_to_nexstrain_buckets.arn
}

resource "aws_iam_policy" "access_to_nexstrain_buckets" {
name = "${var.project_name}-jobs-access-to-nexstrain-buckets"
description = "Read access to Nextstrain's public buckets, for intermediate data files."

policy = jsonencode({
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::nextstrain-data"
]
},
{
"Sid": "VisualEditor1",
"Effect": "Allow",
"Action": [
"s3:GetObject"
],
"Resource": [
"arn:aws:s3:::nextstrain-data/*"
]
}
]
})
}


resource "aws_iam_role_policy_attachment" "ecs_job_role_invalidate_cloudfront" {
role = aws_iam_role.ecs_job_role.name
policy_arn = aws_iam_policy.invalidate_cloudfront.arn
Expand Down
5 changes: 3 additions & 2 deletions puerto-rico_profiles/puerto-rico_open/builds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ custom_rules:

inputs:
- name: "open"
metadata: "https://data.nextstrain.org/files/ncov/open/metadata.tsv.gz"
aligned: "https://data.nextstrain.org/files/ncov/open/aligned.fasta.xz"
metadata: "s3://nextstrain-data/files/ncov/open/metadata.tsv.gz"
aligned: "s3://nextstrain-data/files/ncov/open/sequences.fasta.xz"
skip_sanitize_metadata: true

builds:
puerto-rico:
Expand Down

0 comments on commit 8de83db

Please sign in to comment.