AWS2 namespace
Constants, variables and other
- AMI_OWNER_DEBIAN
- The string "379101102735"
- AMI_OWNER_AMAZON
- The string "801119661308"
Types
- 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/globals/AWS2.ngs:52
Convert hash to Key=...,Value=... strings suitable for passing to AWS CLI. Returns
Arr of StrExample
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/globals/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/globals/AWS2.ngs:70
Convert hash to Name=tag:...,Values=... strings suitable for passing to AWS CLI as filters. Example
filters = AWS2::cli_filters({'vpc-id': ...}) vpcs = ``aws ec2 describe-vpcs --filters $*filters``
- AWS2::regions() Source: autoload/globals/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, regs:Arr=[]) Source: autoload/globals/AWS2.ngs:89
Call cb in parallel threads, each with AWS region name as argument. Parameters
cb Must return an array. regions() sets ._Region in the result and flattens the results Returns
ArrExample
ins = AWS2::regions({ ``aws ec2 describe-instances --region $A $*filters`` })
- AWS2::regions(cp:CommandsPipeline, regs:Arr=[]) Source: autoload/globals/AWS2.ngs:102
Undocumented
- AWS2::zones()internal Source: autoload/globals/AWS2.ngs:122
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/globals/AWS2.ngs:141
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/globals/AWS2.ngs:203
Run an external command related to the resource definition. Will not run the command if rd.dry_run is true. Parameters
do_decode Whether to decode the output Returns
Either parsed output or finished CommandsPipeline (processes in CommandsPipeline finished)
- run
- This multimethod has additional 3 method(s) not listed above, defined in other namespace(s)
- id(r:AWS2::Res) Source: autoload/globals/AWS2.ngs:177
Get unique identifier of a resource Example
AWS2::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/globals/AWS2.ngs:189
Initialize ResDef from kw. Defaults: null for ._Region and empty hash for .Tags
- init(rd:AWS2::ResDef, _ngs_tags:Hash) Source: autoload/globals/AWS2.ngs:201
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/globals/AWS2.ngs:241
Undocumented
- init(rd:AWS2::SecGroup, GroupName:Str, VpcId:Any) Source: autoload/globals/AWS2.ngs:623
Initialize SecGroup from security group name and vpc. Example
AWS2::SecGroup("https-server", AWS2::Vpc(...))
- init(rd:AWS2::Instance, **kwargs:Hash) Source: autoload/globals/AWS2.ngs:851
Initialize Instance (ResDef) from kwargs
- init(rd:AWS2::Zone, Name:Str) Source: autoload/globals/AWS2.ngs:1343
Undocumented
- init
- This multimethod has additional 146 method(s) not listed above, defined in other namespace(s)
- find(rd:AWS2::ResDef) Source: autoload/globals/AWS2.ngs:310
Undocumented
- find(rd:AWS2::Subnet) Source: autoload/globals/AWS2.ngs:720
Declarative primitive for finding AWS Subnet resources
- find(rd:AWS2::Image) Source: autoload/globals/AWS2.ngs:781
Declarative primitive for finding AWS AMI resources
- find(rd:AWS2::Instance) Source: autoload/globals/AWS2.ngs:864
Declarative primitive for finding AWS Instance resources
- find(rd:AWS2::Elb) Source: autoload/globals/AWS2.ngs:1176
Declarative primitive for finding AWS Elastic Load Balancer resources
- find(rd:AWS2::Zone) Source: autoload/globals/AWS2.ngs:1356
Declarative primitive for finding AWS Route53 hosted zones resources
- find(rd:AWS2::RecordSet) Source: autoload/globals/AWS2.ngs:1438
Declarative primitive for finding AWS Route53 RecordSet
- find(rd:AWS2::Volume) Source: autoload/globals/AWS2.ngs:1578
Declarative primitive for finding AWS VPC resources
- find(rd:AWS2::Snapshot) Source: autoload/globals/AWS2.ngs:1619
Declarative primitive for finding AWS VPC resources. Warning: Owner ids starting with zero must be passed as strings.
- find(rd:AWS2::Eip) Source: autoload/globals/AWS2.ngs:1666
Undocumented
- find(rd:AWS2::Any) Source: autoload/globals/AWS2.ngs:1967
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/globals/AWS2.ngs:370
Undocumented
- create(rd:AWS2::Subnet, **props:Hash)internal Source: autoload/globals/AWS2.ngs:736
Declarative primitive for creating AWS Subnet resources
- create(rd:AWS2::Instance, **props:Hash)internal Source: autoload/globals/AWS2.ngs:920
Declarative primitive for creating AWS Instance resources
- create(rd:AWS2::Elb, **props:Hash)internal Source: autoload/globals/AWS2.ngs:1201
Declarative primitive for creating AWS Elastic Load Balancer resources
- create(rd:AWS2::RecordSet, **props:Hash)internal Source: autoload/globals/AWS2.ngs:1488
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/globals/AWS2.ngs:416
Undocumented
- update(sg:AWS2::SecGroupRes, props:Hash)internal Source: autoload/globals/AWS2.ngs:665
Declarative primitive for updating AWS Security Group resources
- update(r:AWS2::SubnetRes, props:Hash)internal Source: autoload/globals/AWS2.ngs:751
Declarative primitive for updating AWS Subnet resources
- update(r:AWS2::InstanceRes, props:Hash)internal Source: autoload/globals/AWS2.ngs:948
Declarative primitive for updating AWS Instance resources
- update(elb:AWS2::ElbRes, props:Hash)internal Source: autoload/globals/AWS2.ngs:1223
Declarative primitive for updating AWS Elastic Load Balancer resources
- update(z:AWS2::ZoneRes, props:Hash) Source: autoload/globals/AWS2.ngs:1393
Undocumented
- update(rrset:AWS2::RecordSetRes, props:Hash)internal Source: autoload/globals/AWS2.ngs:1506
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/globals/AWS2.ngs:436
Undocumented
- delete(r:AWS2::SecGroupRes) Source: autoload/globals/AWS2.ngs:698
Declarative primitive for deleting AWS Security Group resources
- delete(r:AWS2::SubnetRes) Source: autoload/globals/AWS2.ngs:758
Declarative primitive for deleting AWS Subnet resources
- delete(r:AWS2::InstanceRes) Source: autoload/globals/AWS2.ngs:998
Declarative primitive for deleting AWS Instance resources
- delete(r:AWS2::ElbRes) Source: autoload/globals/AWS2.ngs:1300
Declarative primitive for deleting AWS Elastic Load Balancer resources
- delete(z:AWS2::ZoneRes) Source: autoload/globals/AWS2.ngs:1410
Undocumented
- delete(r:AWS2::RecordSetRes) Source: autoload/globals/AWS2.ngs:1524
Declarative primitive for deleting AWS Route53 RecordSet resources
- delete(d:AWS2::DistributionRes) Source: autoload/globals/AWS2.ngs:1796
Undocumented
- delete
- This multimethod has additional 9 method(s) not listed above, defined in other namespace(s)
- ==(a:_RouteBox, b:_RouteBox)internal Source: autoload/globals/AWS2.ngs:526
Internal method. Please do not use. Example
# TODO: example
- ==(a:_IpPermBox, b:_IpPermBox)internal Source: autoload/globals/AWS2.ngs:655
Internal method. Please do not use.
- ==
- This multimethod has additional 20 method(s) not listed above, defined in other namespace(s)
- users_ids(r:AWS2::SecGroup) Source: autoload/globals/AWS2.ngs:627
Undocumented
- users_ids
- This multimethod has additional 1 method(s) not listed above, defined in other namespace(s)
- latest(rd:AWS2::Image) Source: autoload/globals/AWS2.ngs:809
Declarative primitive for referencing latest AWS AMI resources. Will probably be reworked to be special anchor item. Example
AWS2::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/globals/AWS2.ngs:1032
Declarative primitive for waiting for AWS Instance resource to reach given state Parameters
state_name typically "running" or "stopped" (less common) Returns
r
- AWS2::get_console_output(r:AWS2::InstanceRes) Source: autoload/globals/AWS2.ngs:1052
Declarative primitive for getting console output of AWS Instance resource
- AWS2::get_ssh_host_keys(r:AWS2::InstanceRes) Source: autoload/globals/AWS2.ngs:1069
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/globals/AWS2.ngs:1077
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/globals/AWS2.ngs:1088
Declarative primitive for adding ssh host fingerprints of AWS Instance resource to known hosts.
- code(r:AWS2::InstanceRes)experimental Source: autoload/globals/AWS2.ngs:1135
EXPERIMENTAL! Do not use! Converts Instance resources to NGS code. Right now it works in the most primitive way.
- code
- This multimethod has additional 14 method(s) not listed above, defined in other namespace(s)
- AWS2::route53_resource_id(id:Str) Source: autoload/globals/AWS2.ngs:1345
Undocumented
- AWS2::pollute(do_warn:Any=true) Source: autoload/globals/AWS2.ngs:1855
Undocumented
- AWS2::q(s:Str, **kw:Hash) Source: autoload/globals/AWS2.ngs:1908
Undocumented
- AWS2::is_resource_code(s:Str) Source: autoload/globals/AWS2.ngs:1917
Undocumented