cloudformation-tool 1.3.1 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +103 -1
- data/lib/cloud_formation_tool/cloud_formation/stack.rb +8 -1
- data/lib/cloud_formation_tool/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac8bc28255ed8a46ba9d00263b2f1f5f623e54e42def8fa4b3a9a9cccfec8dc5
|
4
|
+
data.tar.gz: 15ff071575bbd2c6b3eddb855dab27a451290dca42bb82d8d979395fd9985b22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f8368e7efa49dfc08beb3279262c39c2b1203a81e13b428e831bf2227de363a888cdbdcdc3e14d12d45ff07ff6969d83138746831364a4f625de80647e36a82
|
7
|
+
data.tar.gz: 83543cf446c340aade8e2de9e303db2069f2dfb6bf472bb68200b8ce25d8f183ad65b550bb51242571a21557c47e78621a76201995d2c6734e323ecbb4c542af
|
data/README.md
CHANGED
@@ -344,7 +344,12 @@ The following commands are supported:
|
|
344
344
|
- `status` - Check if the names stack exists or not
|
345
345
|
- `delete` - Delete the specified stack. After issuing the delete command, the tool will
|
346
346
|
immediately start `monitor` mode until the operation has completed.
|
347
|
-
- `servers` - List EC2 instances created and managed by this stack.
|
347
|
+
- `servers` - List EC2 instances created and managed by this stack, per autoscaling group, including servers in nested stacks.
|
348
|
+
- `groups` - list autoscaling groups managed by the stack, including groups in nested stacks.
|
349
|
+
- `recycle` - recycle servers in an autoscaling group in a stack by scaling the group up and down.
|
350
|
+
- `scale` - set the scale of an autoscaling group managed by a stack to a specific desired value.
|
351
|
+
- `invalidate` - send an invalidation request to a CloudFront distribution managed by a stack.
|
352
|
+
- `output` - retrieve output values from a stack.
|
348
353
|
|
349
354
|
Please see the specific help for each command by running `cftool <command> --help` for
|
350
355
|
more details and specific options.
|
@@ -356,3 +361,100 @@ The AWS region to be used can be select by specifying top level option (i.e. bef
|
|
356
361
|
### Credentials Selection
|
357
362
|
|
358
363
|
The tool will use the standard AWS credentials selection process, except when you want to use AWS CLI configured credential profiles, you may select to use a profile other than "default" by specifying the top level option (i.e. before the command name) `-p <profile>`, by providing the standard environment variable `AWS_DEFAULT_PROFILE` or by having a file called `.awsprofile` - whose content is the name of a valid AWS REGION - in a parent directory (at any level up to the root directory).
|
364
|
+
|
365
|
+
## Library API
|
366
|
+
|
367
|
+
The cloudformatin tool can also be consumed as a library by other applications - for example an application that needs to perform high-level business-logic oriented
|
368
|
+
operations for a specific application deployed in a stack, using the cloudformation tool abstraction of CloudFormation templates and stacks.
|
369
|
+
|
370
|
+
### Usage as a library
|
371
|
+
|
372
|
+
To use the cloudformatin tool as a library, require `cloud_formation_tool`.
|
373
|
+
|
374
|
+
### CloudFormation templates
|
375
|
+
|
376
|
+
The cloudformation pre-compiler can be used to manipulate pre-compiled templates.
|
377
|
+
|
378
|
+
To access the pre-compiler, initialize a `CloudFormationTool::CloudFormation` with the path to the local template resource (either a file or a directory that can be
|
379
|
+
parsed by the pre-compiler).
|
380
|
+
|
381
|
+
The initial template resource will be loaded but will not be fully parsed - and included elements will not be read - until the `compile` method is called.
|
382
|
+
|
383
|
+
The following method calls are available on the `CloudFormation` instance:
|
384
|
+
|
385
|
+
#### `compile(parameters = nil)`
|
386
|
+
|
387
|
+
Pre-compiles the template, with the provided parameter `Hash`, if provided. Returns a `Hash` repsenting the compiled template.
|
388
|
+
|
389
|
+
#### `to_yaml`
|
390
|
+
|
391
|
+
Pre-compiles the template and returns a YAML rendering of the CloudFormation template, suitable for deploying to AWS CloudFormation.
|
392
|
+
|
393
|
+
#### `each`
|
394
|
+
|
395
|
+
Yields a tuple for each defined template parameter, that includes the parameter's name and its default value (if set, `nil` otherwise).
|
396
|
+
|
397
|
+
### CloudFormation stacks
|
398
|
+
|
399
|
+
The cloudformation tool's abstraction of a CloudFormation stack can be used to manipulate stack resouces, such as autoscaling groups or instances in a stack context.
|
400
|
+
|
401
|
+
To access the stack API, initialize a `CloudFormationTool::CloudFormation::Stack` with the name of the stack. You can then access the following methods:
|
402
|
+
|
403
|
+
#### `exist?`
|
404
|
+
|
405
|
+
Check if a stack exists.
|
406
|
+
|
407
|
+
#### `create(template, params = {})`
|
408
|
+
|
409
|
+
Create or update a stack by deploying the specified template. The template can be any local file or directory resource that can be parsed by the cloudformation pre-compiler.
|
410
|
+
|
411
|
+
#### `delete`
|
412
|
+
|
413
|
+
Deletes the stack
|
414
|
+
|
415
|
+
#### `stack_id`
|
416
|
+
|
417
|
+
Return the AWS CloudFormation stack identifier for the stack, which is the ARN of the stack.
|
418
|
+
|
419
|
+
#### `output`
|
420
|
+
|
421
|
+
Returns the output values of the stack
|
422
|
+
|
423
|
+
#### `resources`
|
424
|
+
|
425
|
+
Return a list of resources in the stack and all of its nested stacks
|
426
|
+
|
427
|
+
#### `asgroups`
|
428
|
+
|
429
|
+
Return a list of autoscaling groups in the stack and all of its nested stacks. The returned values are AWS SDK CloudFormation resources, extended with a set of methods
|
430
|
+
to help manage autoscaling groups:
|
431
|
+
|
432
|
+
##### `group`
|
433
|
+
|
434
|
+
Returns the AWS SDK `Aws::AutoScaling::AutoScalingGroup` object for the autoscaling group.
|
435
|
+
|
436
|
+
#### `cdns`
|
437
|
+
|
438
|
+
Return a list of CloudFront CDN distributions in the stack and all of its nested stacks. The returnd values are AWS SDK CloudFormation resources, extended with a set of
|
439
|
+
methods to help manage CloudFront distributions:
|
440
|
+
|
441
|
+
##### `distribution`
|
442
|
+
|
443
|
+
Returns the AWS SDK `Aws::CloudFront::Types::Distribution` object for the CloudFront distribution.
|
444
|
+
|
445
|
+
##### `domain_names`
|
446
|
+
|
447
|
+
Returns the comma delimited list of the distribution aliases domain names
|
448
|
+
|
449
|
+
##### `invalidate(path)`
|
450
|
+
|
451
|
+
Creates a new invalidation in the CloudFront distribution with the specified path expression
|
452
|
+
|
453
|
+
#### `each`
|
454
|
+
|
455
|
+
Yields CloudFormation stack events, in the order they were created. Subsequent calls to `each` will not repeat events previously yielded and will only yield additional
|
456
|
+
events created since the last call to `each`.
|
457
|
+
|
458
|
+
#### `see_event`
|
459
|
+
|
460
|
+
Mark all events since the last call to `each` (or from stack creation, if `each` was not previously called) as "seen" so they will not be yielded in future calls to `each`.
|
@@ -96,7 +96,14 @@ module CloudFormationTool
|
|
96
96
|
def resources
|
97
97
|
begin
|
98
98
|
awscf.list_stack_resources(stack_name: @name).each do |resp|
|
99
|
-
resp.stack_resource_summaries.each
|
99
|
+
resp.stack_resource_summaries.each do |res|
|
100
|
+
yield res
|
101
|
+
if res.resource_type == 'AWS::CloudFormation::Stack'
|
102
|
+
Stack.new(res.physical_resource_id).resources do |nested_res|
|
103
|
+
yield nested_res
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
100
107
|
end
|
101
108
|
rescue Aws::CloudFormation::Errors::ValidationError => e
|
102
109
|
raise CloudFormationTool::Errors::AppError, "Failed to get resources: #{e.message}"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudformation-tool
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oded Arbel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-03-
|
11
|
+
date: 2019-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|