예제 #1
0
 public MyStack()
 {
     var foobarGroup = new Aws.AutoScaling.Group("foobarGroup", new Aws.AutoScaling.GroupArgs
     {
         AvailabilityZones =
         {
             "us-west-2a",
         },
         ForceDelete            = true,
         HealthCheckGracePeriod = 300,
         HealthCheckType        = "ELB",
         MaxSize             = 1,
         MinSize             = 1,
         TerminationPolicies =
         {
             "OldestInstance",
         },
     });
     var foobarSchedule = new Aws.AutoScaling.Schedule("foobarSchedule", new Aws.AutoScaling.ScheduleArgs
     {
         AutoscalingGroupName = foobarGroup.Name,
         DesiredCapacity      = 0,
         EndTime             = "2016-12-12T06:00:00Z",
         MaxSize             = 1,
         MinSize             = 0,
         ScheduledActionName = "foobar",
         StartTime           = "2016-12-11T18:00:00Z",
     });
 }
예제 #2
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,
     });
 }
예제 #3
0
    public MyStack()
    {
        var test = new Aws.Ec2.PlacementGroup("test", new Aws.Ec2.PlacementGroupArgs
        {
            Strategy = "cluster",
        });
        var bar = new Aws.AutoScaling.Group("bar", new Aws.AutoScaling.GroupArgs
        {
            DesiredCapacity        = 4,
            ForceDelete            = true,
            HealthCheckGracePeriod = 300,
            HealthCheckType        = "ELB",
            InitialLifecycleHooks  =
            {
                new Aws.AutoScaling.Inputs.GroupInitialLifecycleHookArgs
                {
                    DefaultResult       = "CONTINUE",
                    HeartbeatTimeout    = 2000,
                    LifecycleTransition = "autoscaling:EC2_INSTANCE_LAUNCHING",
                    Name = "foobar",
                    NotificationMetadata  = @"{
  ""foo"": ""bar""
}

",
                    NotificationTargetArn = "arn:aws:sqs:us-east-1:444455556666:queue1*",
                    RoleArn = "arn:aws:iam::123456789012:role/S3Access",
                },
            },
            LaunchConfiguration = aws_launch_configuration.Foobar.Name,
            MaxSize             = 5,
            MinSize             = 2,
            PlacementGroup      = test.Id,
            Tags =
            {
                new Aws.AutoScaling.Inputs.GroupTagArgs
                {
                    Key = "foo",
                    PropagateAtLaunch = true,
                    Value             = "bar",
                },
                new Aws.AutoScaling.Inputs.GroupTagArgs
                {
                    Key = "lorem",
                    PropagateAtLaunch = false,
                    Value             = "ipsum",
                },
            },
            VpcZoneIdentifiers =
            {
                aws_subnet.Example1.Id,
                aws_subnet.Example2.Id,
            },
        });
    }
예제 #4
0
    public MyStack()
    {
        var foobarGroup = new Aws.AutoScaling.Group("foobarGroup", new Aws.AutoScaling.GroupArgs
        {
            AvailabilityZones =
            {
                "us-west-2a",
            },
            HealthCheckType = "EC2",
            Tags            =
            {
                new Aws.AutoScaling.Inputs.GroupTagArgs
                {
                    Key = "Foo",
                    PropagateAtLaunch = true,
                    Value             = "foo-bar",
                },
            },
            TerminationPolicies =
            {
                "OldestInstance",
            },
        });
        var foobarLifecycleHook = new Aws.AutoScaling.LifecycleHook("foobarLifecycleHook", new Aws.AutoScaling.LifecycleHookArgs
        {
            AutoscalingGroupName  = foobarGroup.Name,
            DefaultResult         = "CONTINUE",
            HeartbeatTimeout      = 2000,
            LifecycleTransition   = "autoscaling:EC2_INSTANCE_LAUNCHING",
            NotificationMetadata  = @"{
  ""foo"": ""bar""
}

",
            NotificationTargetArn = "arn:aws:sqs:us-east-1:444455556666:queue1*",
            RoleArn = "arn:aws:iam::123456789012:role/S3Access",
        });
    }
예제 #5
0
 public MyStack()
 {
     var bar = new Aws.AutoScaling.Group("bar", new Aws.AutoScaling.GroupArgs
     {
         AvailabilityZones =
         {
             "us-east-1a",
         },
         ForceDelete            = true,
         HealthCheckGracePeriod = 300,
         HealthCheckType        = "ELB",
         LaunchConfiguration    = aws_launch_configuration.Foo.Name,
         MaxSize = 5,
         MinSize = 2,
     });
     var bat = new Aws.AutoScaling.Policy("bat", new Aws.AutoScaling.PolicyArgs
     {
         AdjustmentType       = "ChangeInCapacity",
         AutoscalingGroupName = bar.Name,
         Cooldown             = 300,
         ScalingAdjustment    = 4,
     });
 }
예제 #6
0
 public MyStack()
 {
     var foobar = new Aws.Ec2.LaunchTemplate("foobar", new Aws.Ec2.LaunchTemplateArgs
     {
         ImageId      = "ami-1a2b3c",
         InstanceType = "t2.micro",
         NamePrefix   = "foobar",
     });
     var bar = new Aws.AutoScaling.Group("bar", new Aws.AutoScaling.GroupArgs
     {
         AvailabilityZones =
         {
             "us-east-1a",
         },
         DesiredCapacity = 1,
         LaunchTemplate  = new Aws.AutoScaling.Inputs.GroupLaunchTemplateArgs
         {
             Id      = foobar.Id,
             Version = "$Latest",
         },
         MaxSize = 1,
         MinSize = 1,
     });
 }