AWS2 namespace

Amazon Web Services. This namespace is under development. Use at your own risk. This namespace contains resource types that implement common methods: find(), create(), delete(), converge()

Constants, variables and other

AMI_OWNER_DEBIAN
The string "379101102735"
AMI_OWNER_AMAZON
The string "801119661308"

Types

35 types, which are descendants of types listed below, are not shown for brevity
AWS2::CreateOnly
A Box for a property which is to be used only at creation time, not when a resource is updated
AWS2::Res
AWS resource
Direct subtypes: 17
AWS2::ResDef
AWS Resource definition
Direct subtypes: 18
AWS2::Parameter
A Box for a property which is to be used only at creation time, not when a resource is updated

Methods and Multimethods

AWS2::cli_tags(h:Hash) Source: autoload/AWS2.ngs:52
Convert hash to Key=...,Value=... strings suitable for passing to AWS CLI.

Returns

Arr of Str

Example

diff = Diff(current_tags, target_tags)
if (tags = cli_tags(diff.add + diff.change)) {
	r.run('add tags', %(aws ec2 create-tags --resources ${r.id()} --tags $*tags))
}
AWS2::cli_filters(h:Hash) Source: autoload/AWS2.ngs:59
Convert Hash with AWS filters to command line arguments. Key-value pairs in which value is null or an EmptyBox object are discarded. TODO: make it JSON when keys or values contain special characters such as = or ,

Returns

Arr of Str
AWS2::cli_tags_filters(h:Hash) Source: autoload/AWS2.ngs:70
Convert hash to Name=tag:...,Values=... strings suitable for passing to AWS CLI as filters.

Example

filters = AWS::cli_filters({'vpc-id': ...})
vpcs = ``aws ec2 describe-vpcs --filters $*filters``
AWS2::regions() Source: autoload/AWS2.ngs:87
Get list of AWS regions. If NGS_AWS_REGIONS environment variable is set, it is used as comma separated list. Otherwise AWS CLI command describe-regions is used. In future, the results of AWS CLI call might be cached.
AWS2::regions(cb:Fun) Source: autoload/AWS2.ngs:94
Call cb in parallel threads, each with AWS region name as argument.

Parameters

cbMust return an array. regions() sets ._Region in the result and flattens the results

Returns

Arr

Example

ins = AWS::regions({ ``aws ec2 describe-instances --region $A $*filters`` })
AWS2::zones()internal Source: autoload/AWS2.ngs:108
Internal method. Please do not use. It does not support regions yet.

Returns

Arr of Str
run(r:AWS2::Res, log_pfx:Str, cp:CommandsPipeline, do_decode:Any=true)internal Source: autoload/AWS2.ngs:129
Run a command. Internal method. Please do not use outside the AWS library.
run(rd:AWS2::ResDef, log_pfx:Str, cp:CommandsPipeline, do_decode:Any=true)internal Source: autoload/AWS2.ngs:194
Run an external command related to the resource definition. Will not run the command if rd.dry_run is true.

Parameters

do_decodeWhether to decode the output

Returns

Either parsed output or finished CommandsPipeline (processes in CommandsPipeline finished)
run
This multimethod has additional 2 method(s) not listed above, defined in other namespace(s)
id(r:AWS2::Res) Source: autoload/AWS2.ngs:163
Get unique identifier of a resource

Example

AWS::Instance().find().resources[0].id()  # i-0011b2.....
id
This multimethod has additional 2 method(s) not listed above, defined in other namespace(s)
init(rd:AWS2::ResDef, **kw:Hash) Source: autoload/AWS2.ngs:175
Initialize ResDef from kw. Defaults: null for ._Region and empty hash for .Tags
init(rd:AWS2::ResDef, _ngs_tags:Hash) Source: autoload/AWS2.ngs:187
Initialize ResDef from _ngs_tags. Sets ._Region to null and .Tags to _ngs_tags.
init(p:AWS2::Parameter, res_type:Type, param_name:Str, param_value:Any) Source: autoload/AWS2.ngs:227
Undocumented
init(rd:AWS2::SecGroup, GroupName:Str, VpcId:Any) Source: autoload/AWS2.ngs:607
Initialize SecGroup from security group name and vpc.

Example

AWS::SecGroup("https-server", AWS::Vpc(...))
init(rd:AWS2::Instance, **kwargs:Hash) Source: autoload/AWS2.ngs:848
Initialize Instance (ResDef) from kwargs
init(rd:AWS2::Zone, Name:Str) Source: autoload/AWS2.ngs:1340
Undocumented
init
This multimethod has additional 93 method(s) not listed above, defined in other namespace(s)
find(rd:AWS2::ResDef) Source: autoload/AWS2.ngs:296
Undocumented
find(rd:AWS2::Subnet) Source: autoload/AWS2.ngs:717
Declarative primitive for finding AWS Subnet resources
find(rd:AWS2::Image) Source: autoload/AWS2.ngs:778
Declarative primitive for finding AWS AMI resources
find(rd:AWS2::Instance) Source: autoload/AWS2.ngs:861
Declarative primitive for finding AWS Instance resources
find(rd:AWS2::Elb) Source: autoload/AWS2.ngs:1173
Declarative primitive for finding AWS Elastic Load Balancer resources
find(rd:AWS2::Zone) Source: autoload/AWS2.ngs:1353
Declarative primitive for finding AWS Route53 hosted zones resources
find(rd:AWS2::RecordSet) Source: autoload/AWS2.ngs:1435
Declarative primitive for finding AWS Route53 RecordSet
find(rd:AWS2::Volume) Source: autoload/AWS2.ngs:1575
Declarative primitive for finding AWS VPC resources
find(rd:AWS2::Snapshot) Source: autoload/AWS2.ngs:1616
Declarative primitive for finding AWS VPC resources. Warning: Owner ids starting with zero must be passed as strings.
find(rd:AWS2::Eip) Source: autoload/AWS2.ngs:1663
Undocumented
find(rd:AWS2::Any) Source: autoload/AWS2.ngs:1964
EXPERIMENTAL! Do not use!
find
This multimethod has additional 14 method(s) not listed above, defined in other namespace(s)
create(rd:AWS2::ResDef, **orig_props:Hash) Source: autoload/AWS2.ngs:354
Undocumented
create(rd:AWS2::Subnet, **props:Hash)internal Source: autoload/AWS2.ngs:733
Declarative primitive for creating AWS Subnet resources
create(rd:AWS2::Instance, **props:Hash)internal Source: autoload/AWS2.ngs:917
Declarative primitive for creating AWS Instance resources
create(rd:AWS2::Elb, **props:Hash)internal Source: autoload/AWS2.ngs:1198
Declarative primitive for creating AWS Elastic Load Balancer resources
create(rd:AWS2::RecordSet, **props:Hash)internal Source: autoload/AWS2.ngs:1485
Declarative primitive for creating AWS Route53 RecordSet resources
create
This multimethod has additional 8 method(s) not listed above, defined in other namespace(s)
update(r:AWS2::Res, orig_props:Hash) Source: autoload/AWS2.ngs:400
Undocumented
update(sg:AWS2::SecGroupRes, props:Hash)internal Source: autoload/AWS2.ngs:662
Declarative primitive for updating AWS Security Group resources
update(r:AWS2::SubnetRes, props:Hash)internal Source: autoload/AWS2.ngs:748
Declarative primitive for updating AWS Subnet resources
update(r:AWS2::InstanceRes, props:Hash)internal Source: autoload/AWS2.ngs:945
Declarative primitive for updating AWS Instance resources
update(elb:AWS2::ElbRes, props:Hash)internal Source: autoload/AWS2.ngs:1220
Declarative primitive for updating AWS Elastic Load Balancer resources
update(z:AWS2::ZoneRes, props:Hash) Source: autoload/AWS2.ngs:1390
Undocumented
update(rrset:AWS2::RecordSetRes, props:Hash)internal Source: autoload/AWS2.ngs:1503
Declarative primitive for updating AWS Route53 RecordSet resources
update
This multimethod has additional 9 method(s) not listed above, defined in other namespace(s)
delete(r:AWS2::Res) Source: autoload/AWS2.ngs:420
Undocumented
delete(r:AWS2::SecGroupRes) Source: autoload/AWS2.ngs:695
Declarative primitive for deleting AWS Security Group resources
delete(r:AWS2::SubnetRes) Source: autoload/AWS2.ngs:755
Declarative primitive for deleting AWS Subnet resources
delete(r:AWS2::InstanceRes) Source: autoload/AWS2.ngs:995
Declarative primitive for deleting AWS Instance resources
delete(r:AWS2::ElbRes) Source: autoload/AWS2.ngs:1297
Declarative primitive for deleting AWS Elastic Load Balancer resources
delete(z:AWS2::ZoneRes) Source: autoload/AWS2.ngs:1407
Undocumented
delete(r:AWS2::RecordSetRes) Source: autoload/AWS2.ngs:1521
Declarative primitive for deleting AWS Route53 RecordSet resources
delete(d:AWS2::DistributionRes) Source: autoload/AWS2.ngs:1793
Undocumented
delete
This multimethod has additional 9 method(s) not listed above, defined in other namespace(s)
==(a:_RouteBox, b:_RouteBox)internal Source: autoload/AWS2.ngs:510
Internal method. Please do not use.

Example

# TODO: example
==(a:_IpPermBox, b:_IpPermBox)internal Source: autoload/AWS2.ngs:639
Internal method. Please do not use.
==
This multimethod has additional 16 method(s) not listed above, defined in other namespace(s)
users_ids(r:AWS2::SecGroup) Source: autoload/AWS2.ngs:611
Undocumented
users_ids
This multimethod has additional 1 method(s) not listed above, defined in other namespace(s)
latest(rd:AWS2::Image) Source: autoload/AWS2.ngs:806
Declarative primitive for referencing latest AWS AMI resources. Will probably be reworked to be special anchor item.

Example

AWS::Image(OwnerId=AWS_AMI_OWNER_DEBIAN, Name=Pfx('debian-jessie-amd64-hvm'), RootDeviceType='ebs', VolumeType='gp2').latest()
latest
This multimethod has additional 1 method(s) not listed above, defined in other namespace(s)
AWS2::wait_state(r:AWS2::InstanceRes, state_name:Str) Source: autoload/AWS2.ngs:1029
Declarative primitive for waiting for AWS Instance resource to reach given state

Parameters

state_nametypeically "running" or "stopped" (less common)

Returns

r
AWS2::get_console_output(r:AWS2::InstanceRes) Source: autoload/AWS2.ngs:1049
Declarative primitive for getting console output of AWS Instance resource
AWS2::get_ssh_host_keys(r:AWS2::InstanceRes) Source: autoload/AWS2.ngs:1066
Declarative primitive for getting ssh host fingerprints of AWS Instance resource

Returns

Array of Str. Each Str format "key-type base64key"
AWS2::add_to_known_hosts(r:AWS2::Instance, prop_name:Str)experimental Source: autoload/AWS2.ngs:1074
Declarative primitive for adding ssh host fingerprints of AWS Instance resource to known hosts.
AWS2::add_to_known_hosts(r:AWS2::InstanceRes, ip_or_hostname:Any)experimental Source: autoload/AWS2.ngs:1085
Declarative primitive for adding ssh host fingerprints of AWS Instance resource to known hosts.
code(r:AWS2::InstanceRes)experimental Source: autoload/AWS2.ngs:1132
EXPERIMENTAL! Do not use! Converts Instance resources to NGS code. Right now it works in the most primitive way.
code
This multimethod has additional 7 method(s) not listed above, defined in other namespace(s)
AWS2::route53_resource_id(id:Str) Source: autoload/AWS2.ngs:1342
Undocumented
AWS2::pollute(do_warn:Any=true) Source: autoload/AWS2.ngs:1855
Undocumented
AWS2::q(s:Str, **kw:Hash) Source: autoload/AWS2.ngs:1905
Undocumented
AWS2::is_resource_code(s:Str) Source: autoload/AWS2.ngs:1914
Undocumented