Esempio n. 1
0
 public MyStack()
 {
     var example  = Output.Create(Aws.Organizations.GetOrganization.InvokeAsync());
     var snsTopic = new Aws.Sns.Topic("snsTopic", new Aws.Sns.TopicArgs
     {
     });
     var snsTopicPolicyPolicyDocument = Output.Tuple(example, snsTopic.Arn).Apply(values =>
     {
         var example = values.Item1;
         var arn     = values.Item2;
         return(Aws.Iam.GetPolicyDocument.InvokeAsync(new Aws.Iam.GetPolicyDocumentArgs
         {
             Statements =
             {
                 new Aws.Iam.Inputs.GetPolicyDocumentStatementArgs
                 {
                     Actions =
                     {
                         "SNS:Subscribe",
                         "SNS:Publish",
                     },
                     Condition =
                     {
                         {
                             { "test",     "StringEquals"           },
Esempio n. 2
0
 public MyStack()
 {
     var defaultCluster = new Aws.RedShift.Cluster("defaultCluster", new Aws.RedShift.ClusterArgs
     {
         ClusterIdentifier = "default",
         DatabaseName      = "default",
     });
     var defaultTopic = new Aws.Sns.Topic("defaultTopic", new Aws.Sns.TopicArgs
     {
     });
     var defaultEventSubscription = new Aws.RedShift.EventSubscription("defaultEventSubscription", new Aws.RedShift.EventSubscriptionArgs
     {
         EventCategories =
         {
             "configuration",
             "management",
             "monitoring",
             "security",
         },
         Severity    = "INFO",
         SnsTopicArn = defaultTopic.Arn,
         SourceIds   =
         {
             defaultCluster.Id,
         },
         SourceType = "cluster",
         Tags       =
         {
             { "Name", "default" },
         },
     });
 }
Esempio n. 3
0
 public MyStack()
 {
     var example = new Aws.Sns.Topic("example", new Aws.Sns.TopicArgs
     {
     });
     var bar = new Aws.AutoScaling.Group("bar", new Aws.AutoScaling.GroupArgs
     {
     });
     var foo = new Aws.AutoScaling.Group("foo", new Aws.AutoScaling.GroupArgs
     {
     });
     var exampleNotifications = new Aws.AutoScaling.Notification("exampleNotifications", new Aws.AutoScaling.NotificationArgs
     {
         GroupNames =
         {
             bar.Name,
             foo.Name,
         },
         Notifications =
         {
             "autoscaling:EC2_INSTANCE_LAUNCH",
             "autoscaling:EC2_INSTANCE_TERMINATE",
             "autoscaling:EC2_INSTANCE_LAUNCH_ERROR",
             "autoscaling:EC2_INSTANCE_TERMINATE_ERROR",
         },
         TopicArn = example.Arn,
     });
 }
Esempio n. 4
0
    private static void ConfigureRequiredAwsServices()
    {
        var snsTopic = new Pulumi.Aws.Sns.Topic($"{baseName}-sns1");

        var sqsQueue = new Pulumi.Aws.Sqs.Queue($"{baseName}-123-name");

        var secondRequiredQueue = new Pulumi.Aws.Sqs.Queue($"{baseName}-456-name");

        var subscription = new Pulumi.Aws.Sns.TopicSubscription($"{baseName}-sub1", new Pulumi.Aws.Sns.TopicSubscriptionArgs()
        {
            Topic    = snsTopic.Arn,
            Protocol = "sqs",
            Endpoint = sqsQueue.Arn,
        });

        var attrArgs = new TableAttributesArgs()
        {
            Name = "Id",
            Type = "S",
        };

        var table = new Pulumi.Aws.DynamoDB.Table($"{baseName}-mytable", new Pulumi.Aws.DynamoDB.TableArgs()
        {
            Attributes    = attrArgs,
            HashKey       = "Id",
            WriteCapacity = 5,
            ReadCapacity  = 5,
        });
    }
Esempio n. 5
0
    public MyStack()
    {
        var exampleRole = new Aws.Iam.Role("exampleRole", new Aws.Iam.RoleArgs
        {
            AssumeRolePolicy = @"{
  ""Version"": ""2012-10-17"",
  ""Statement"": [
    {
      ""Sid"": """",
      ""Effect"": ""Allow"",
      ""Principal"": {
        ""Service"": ""codedeploy.amazonaws.com""
      },
      ""Action"": ""sts:AssumeRole""
    }
  ]
}

",
        });
        var aWSCodeDeployRole = new Aws.Iam.RolePolicyAttachment("aWSCodeDeployRole", new Aws.Iam.RolePolicyAttachmentArgs
        {
            PolicyArn = "arn:aws:iam::aws:policy/service-role/AWSCodeDeployRole",
            Role      = exampleRole.Name,
        });
        var exampleApplication = new Aws.CodeDeploy.Application("exampleApplication", new Aws.CodeDeploy.ApplicationArgs
        {
        });
        var exampleTopic = new Aws.Sns.Topic("exampleTopic", new Aws.Sns.TopicArgs
        {
        });
        var exampleDeploymentGroup = new Aws.CodeDeploy.DeploymentGroup("exampleDeploymentGroup", new Aws.CodeDeploy.DeploymentGroupArgs
        {
            AlarmConfiguration = new Aws.CodeDeploy.Inputs.DeploymentGroupAlarmConfigurationArgs
            {
                Alarms =
                {
                    "my-alarm-name",
                },
                Enabled = true,
            },
            AppName = exampleApplication.Name,
            AutoRollbackConfiguration = new Aws.CodeDeploy.Inputs.DeploymentGroupAutoRollbackConfigurationArgs
            {
                Enabled = true,
                Events  =
                {
                    "DEPLOYMENT_FAILURE",
                },
            },
            DeploymentGroupName = "example-group",
            Ec2TagSets          =
            {
                new Aws.CodeDeploy.Inputs.DeploymentGroupEc2TagSetArgs
                {
                    Ec2TagFilter =
                    {
                        {
                            { "key",   "filterkey1"      },
Esempio n. 6
0
    public MyStack()
    {
        var console = new Aws.CloudWatch.EventRule("console", new Aws.CloudWatch.EventRuleArgs
        {
            Description  = "Capture each AWS Console Sign In",
            EventPattern = @"{
  ""detail-type"": [
    ""AWS Console Sign In via CloudTrail""
  ]
}

",
        });
        var awsLogins = new Aws.Sns.Topic("awsLogins", new Aws.Sns.TopicArgs
        {
        });
        var sns = new Aws.CloudWatch.EventTarget("sns", new Aws.CloudWatch.EventTargetArgs
        {
            Arn  = awsLogins.Arn,
            Rule = console.Name,
        });
        var snsTopicPolicy = awsLogins.Arn.Apply(arn => Aws.Iam.GetPolicyDocument.InvokeAsync(new Aws.Iam.GetPolicyDocumentArgs
        {
            Statements =
            {
                new Aws.Iam.Inputs.GetPolicyDocumentStatementArgs
                {
                    Actions =
                    {
                        "SNS:Publish",
                    },
                    Effect     = "Allow",
                    Principals =
                    {
                        new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalArgs
                        {
                            Identifiers =
                            {
                                "events.amazonaws.com",
                            },
                            Type = "Service",
                        },
                    },
                    Resources =
                    {
                        arn,
                    },
                },
            },
        }));
        var @default = new Aws.Sns.TopicPolicy("default", new Aws.Sns.TopicPolicyArgs
        {
            Arn    = awsLogins.Arn,
            Policy = snsTopicPolicy.Apply(snsTopicPolicy => snsTopicPolicy.Json),
        });
    }
Esempio n. 7
0
 public MyStack()
 {
     var defaultCluster = new Aws.Neptune.Cluster("defaultCluster", new Aws.Neptune.ClusterArgs
     {
         ApplyImmediately      = true,
         BackupRetentionPeriod = 5,
         ClusterIdentifier     = "neptune-cluster-demo",
         Engine = "neptune",
         IamDatabaseAuthenticationEnabled = true,
         PreferredBackupWindow            = "07:00-09:00",
         SkipFinalSnapshot = true,
     });
     var example = new Aws.Neptune.ClusterInstance("example", new Aws.Neptune.ClusterInstanceArgs
     {
         ApplyImmediately  = true,
         ClusterIdentifier = defaultCluster.Id,
         Engine            = "neptune",
         InstanceClass     = "db.r4.large",
     });
     var defaultTopic = new Aws.Sns.Topic("defaultTopic", new Aws.Sns.TopicArgs
     {
     });
     var defaultEventSubscription = new Aws.Neptune.EventSubscription("defaultEventSubscription", new Aws.Neptune.EventSubscriptionArgs
     {
         EventCategories =
         {
             "maintenance",
             "availability",
             "creation",
             "backup",
             "restoration",
             "recovery",
             "deletion",
             "failover",
             "failure",
             "notification",
             "configuration change",
             "read replica",
         },
         SnsTopicArn = defaultTopic.Arn,
         SourceIds   =
         {
             example.Id,
         },
         SourceType = "db-instance",
         Tags       =
         {
             { "env", "test" },
         },
     });
 }
Esempio n. 8
0
    public MyStack()
    {
        var awsSnsTopic = new Aws.Sns.Topic("awsSnsTopic", new Aws.Sns.TopicArgs
        {
        });
        var myArchive = new Aws.Glacier.Vault("myArchive", new Aws.Glacier.VaultArgs
        {
            AccessPolicy  = @"{
    ""Version"":""2012-10-17"",
    ""Statement"":[
       {
          ""Sid"": ""add-read-only-perm"",
          ""Principal"": ""*"",
          ""Effect"": ""Allow"",
          ""Action"": [
             ""glacier:InitiateJob"",
             ""glacier:GetJobOutput""
          ],
          ""Resource"": ""arn:aws:glacier:eu-west-1:432981146916:vaults/MyArchive""
       }
    ]
}

",
            Notifications =
            {
                new Aws.Glacier.Inputs.VaultNotificationArgs
                {
                    Events =
                    {
                        "ArchiveRetrievalCompleted",
                        "InventoryRetrievalCompleted",
                    },
                    SnsTopic = awsSnsTopic.Arn,
                },
            },
            Tags =
            {
                { "Test", "MyArchive" },
            },
        });
    }
Esempio n. 9
0
 public MyStack()
 {
     var defaultInstance = new Aws.Rds.Instance("defaultInstance", new Aws.Rds.InstanceArgs
     {
         AllocatedStorage  = 10,
         DbSubnetGroupName = "my_database_subnet_group",
         Engine            = "mysql",
         EngineVersion     = "5.6.17",
         InstanceClass     = "db.t2.micro",
         Name = "mydb",
         ParameterGroupName = "default.mysql5.6",
         Password           = "******",
         Username           = "******",
     });
     var defaultTopic = new Aws.Sns.Topic("defaultTopic", new Aws.Sns.TopicArgs
     {
     });
     var defaultEventSubscription = new Aws.Rds.EventSubscription("defaultEventSubscription", new Aws.Rds.EventSubscriptionArgs
     {
         EventCategories =
         {
             "availability",
             "deletion",
             "failover",
             "failure",
             "low storage",
             "maintenance",
             "notification",
             "read replica",
             "recovery",
             "restoration",
         },
         SnsTopic  = defaultTopic.Arn,
         SourceIds =
         {
             defaultInstance.Id,
         },
         SourceType = "db-instance",
     });
 }
Esempio n. 10
0
    public MyStack()
    {
        var mytopic = new Aws.Sns.Topic("mytopic", new Aws.Sns.TopicArgs
        {
        });
        var role = new Aws.Iam.Role("role", new Aws.Iam.RoleArgs
        {
            AssumeRolePolicy = @"{
  ""Version"": ""2012-10-17"",
  ""Statement"": [
    {
      ""Effect"": ""Allow"",
      ""Principal"": {
        ""Service"": ""iot.amazonaws.com""
      },
      ""Action"": ""sts:AssumeRole""
    }
  ]
}

",
        });
        var rule = new Aws.Iot.TopicRule("rule", new Aws.Iot.TopicRuleArgs
        {
            Description = "Example rule",
            Enabled     = true,
            Sns         = new Aws.Iot.Inputs.TopicRuleSnsArgs
            {
                Sns = "RAW",
                Sns = role.Arn,
                Sns = mytopic.Arn,
            },
            Sql        = "SELECT * FROM 'topic/test'",
            SqlVersion = "2016-03-23",
        });
        var iamPolicyForLambda = new Aws.Iam.RolePolicy("iamPolicyForLambda", new Aws.Iam.RolePolicyArgs
        {
            Policy = mytopic.Arn.Apply(arn => @$ "{{
  " "Version" ": " "2012-10-17" ",
  " "Statement" ": [
Esempio n. 11
0
    public MyStack()
    {
        var topic = new Aws.Sns.Topic("topic", new Aws.Sns.TopicArgs
        {
            Policy = @"{
    ""Version"":""2012-10-17"",
    ""Statement"":[{
        ""Effect"": ""Allow"",
        ""Principal"": {
            ""Service"": ""vpce.amazonaws.com""
        },
        ""Action"": ""SNS:Publish"",
        ""Resource"": ""arn:aws:sns:*:*:vpce-notification-topic""
    }]
}

",
        });
        var fooVpcEndpointService = new Aws.Ec2.VpcEndpointService("fooVpcEndpointService", new Aws.Ec2.VpcEndpointServiceArgs
        {
            AcceptanceRequired      = false,
            NetworkLoadBalancerArns =
            {
                aws_lb.Test.Arn,
            },
        });
        var fooVpcEndpointConnectionNotification = new Aws.Ec2.VpcEndpointConnectionNotification("fooVpcEndpointConnectionNotification", new Aws.Ec2.VpcEndpointConnectionNotificationArgs
        {
            ConnectionEvents =
            {
                "Accept",
                "Reject",
            },
            ConnectionNotificationArn = topic.Arn,
            VpcEndpointServiceId      = fooVpcEndpointService.Id,
        });
    }
Esempio n. 12
0
 public MyStack()
 {
     var test = new Aws.Sns.Topic("test", new Aws.Sns.TopicArgs
     {
     });
     var snsTopicPolicy = test.Arn.Apply(arn => Aws.Iam.GetPolicyDocument.InvokeAsync(new Aws.Iam.GetPolicyDocumentArgs
     {
         PolicyId   = "__default_policy_ID",
         Statements =
         {
             new Aws.Iam.Inputs.GetPolicyDocumentStatementArgs
             {
                 Actions =
                 {
                     "SNS:Subscribe",
                     "SNS:SetTopicAttributes",
                     "SNS:RemovePermission",
                     "SNS:Receive",
                     "SNS:Publish",
                     "SNS:ListSubscriptionsByTopic",
                     "SNS:GetTopicAttributes",
                     "SNS:DeleteTopic",
                     "SNS:AddPermission",
                 },
Esempio n. 13
0
 public MyStack()
 {
     var userUpdates = new Aws.Sns.Topic("userUpdates", new Aws.Sns.TopicArgs
     {
     });
 }