Sha256: ac8a913b568331102f24a01b9ea48b7e9a2900e3ffb6336c712b1ebedcb85778

Contents?: true

Size: 1.33 KB

Versions: 1

Compression:

Stored size: 1.33 KB

Contents

# By not specifying a default value, a parameter becomes required.
# Specify this parameter by adding `--parameters KeyName:<ec2-keyname>` to your CLI options.
parameter :KeyName

# We define some more parameters the same way we did in the VPC template.
# Cfer will fetch the output values from the `vpc` stack we created earlier.
#
# If you created the VPC stack with a different name, you can overwrite these default values
# by adding `Vpc:<vpc_stack_name> to your `--parameters` option
parameter :Vpc, default: 'vpc'
parameter :VpcId, default: lookup_output(parameters[:Vpc], 'vpcid')
parameter :SubnetId, default: lookup_output(parameters[:Vpc], 'subnetid1')

# This is the Ubuntu 14.04 LTS HVM AMI provided by Amazon.
parameter :ImageId, default: 'ami-fce3c696'
parameter :InstanceType, default: 't2.nano'

# Define a security group to be applied to an instance.
# This one will allow SSH access from anywhere, and no other inbound traffic.
resource :instancesg, "AWS::EC2::SecurityGroup" do
  group_description 'Wide-open SSH'
  vpc_id Fn::ref(:VpcId)

  # Parameter values can be Ruby arrays and hashes. These will be transformed to JSON.
  # You could write your own functions to make stuff like this easier, too.
  security_group_ingress [
    {
      CidrIp: '0.0.0.0/0',
      IpProtocol: 'tcp',
      FromPort: 22,
      ToPort: 22
    }
  ]
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cfer-0.3.0 examples/common/instance_deps.rb