queirozsc
8/13/2017 - 7:30 AM

[sns] O Amazon Simple Notification Service (SNS) é um serviço flexível e totalmente gerenciado de notificações móveis e mensagens do tipo pu

[sns] O Amazon Simple Notification Service (SNS) é um serviço flexível e totalmente gerenciado de notificações móveis e mensagens do tipo publicação/assinatura (Pub/Sub) para a coordenação da entrega de mensagens a endpoints e clientes inscritos #aws #sns

#Note: You don't have to use email if you don't want to. Feel free to use whichever protocol/endpoint fits you.
aws sns subscribe --topic-arn ARN --protocol email --notification-endpoint sergio.queiroz@buildnprice.io
#Creating an SNS topic
aws sns create-topic --name IAM-Access-Key-Rotation-Topic
#local file: role-trust-policy.json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "Service": "lambda.amazonaws.com"
      },
      "Action": "sts:AssumeRole"
    }
  ]
}

#Creating the IAM role for the Lambda function
aws iam create-role --role-name rotate-old-access-keys-notification-role --assume-role-policy-document file://role-trust-policy.json
aws iam attach-role-policy --policy-arn ARN --role-name rotate-old-access-keys-notification-role
#local file: iam-policy.json
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "sns:Publish"
            ],
            "Resource": [
                "Your Topic ARN"
            ]
        },
        {
            "Effect": "Allow",
            "Action": [
                "iam:ListAccessKeys",
                "iam:ListUsers"
            ],
            "Resource": [
                "*"
            ]
        }
    ]
}

#Creating an IAM policy for access permissions
aws iam create-policy --policy-name rotate-old-access-keys-notification-policy --policy-document file://iam-policy.json