Skip to content

[Bug]: DAAC SNS publish updates #577

Closed
@wphyojpl

Description

@wphyojpl

Checked for duplicates

Have you checked for duplicate issue tickets?

Yes - I've already checked

Describe the bug

A clear and concise description of what the bug is. Plain-text snippets preferred but screenshots welcome.

SNS message publishing to DAAC failed


As it says in the following section:
<doc>
TROPESS provider needs to assume the STS role from GES DISC Cumulus:
aws sts assume-role --role-arn arn:aws:iam::xxx:role/xxx --role-session-name xxx --duration-seconds 43200

What did you expect?

Publishing SNS message.

Reproducible steps

Run this:
https://api.test.mdps.mcp.nasa.gov/am-uds-dapa/docs#/Granules%20Archive%20CRUD%20API/archive_single_granule_dapa_am_uds_dapa_collections__collection_id__archive__granule_id___put

What is your environment?

Unity Test

Solution
Add this to lambda role:

        {
            "Action": [
                "sts:AssumeRole",
            ],
            "Effect": "Allow",
            "Resource": [
                "arn:aws:iam::*:role/*"
            ]
        }
  • TODO: Is this too broad? But how to control it as the role name can be anything created by DAAC.

Add this to SNS class

        sts_client = self.get_client('sts')

        assumed_role = sts_client.assume_role(
            RoleArn='arn:aws:iam::xxx:role/xxx',
            RoleSessionName='xxx',
            DurationSeconds=900  # 12 hours max
        )

        credentials = assumed_role['Credentials']

        self.__special_sns_client = self.get_session().client(
            "sns",
            aws_access_key_id=credentials['AccessKeyId'],
            aws_secret_access_key=credentials['SecretAccessKey'],
            aws_session_token=credentials['SessionToken'],
        )

Use the __special_sns_client with a flag to differentiate to send to DAAC.

  • TODO The RoleArn and RoleSessionName may be dynamic which also needs to come when the request is made.

Metadata

Metadata

Labels

bugSomething isn't working

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions