 	#
 	#
 	
+	extract_namespace: (node_name) ->
+		###
+		Extracts a namespace by looking it up in the node itself and upper layers of the manifest
+		###
+		
+		try
+			node = @get_node node_name
+		catch
+			node = null
+			
+		return node.namespace if node?.namespace?
+		return @manifest.namespace if @manifest.namespace?
+		
+	extract_client_options: (node_name) ->
+		###
+		Extracts options related to the AWS client.
+		###
+		
+		access_key_id = @extract_access_key_id node_name
+		secret_access_key = @extract_secret_access_key node_name
+		region = @extract_region node_name
+		max_retries = @extract_max_retries node_name
+		options = {}
+		
+		options.accessKeyId = access_key_id if access_key_id
+		options.secretAccessKey = secret_access_key if secret_access_key
+		options.region = region if region
+		options.maxRetries = max_retries if max_retries
+		
+		return options
+		
+	extract_instance_options: (node_name) ->
+		###
+		Extracts options related to AWS instances.
+		###
+		
+		image_id = this.extract_image_id node_name
+		instance_type = this.extract_instance_type node_name
+		key_name = this.extract_key_name node_name
+		security_groups = this.extract_security_groups node_name
+		user_data = this.extract_user_data node_name
+		disable_api_termination = this.extract_disable_api_termination node_name
+		options = {}
+		
+		options.ImageId = image_id if image_id
+		options.InstanceType = instance_type if instance_type
+		options.KeyName = key_name if key_name
+		options.SecurityGroups = security_groups if security_groups
+		options.UserData = user_data if user_data
+		options.DisableApiTermination = disable_api_termination if disable_api_termination
+		
+		return options
+		
+	get_client: (node_name) ->
+		###
+		Obtain a client for EC2.
+		###
+		
+		return new aws_sdk.EC2 @extract_client_options node_name
+		
 	create_error: (error, node_name) ->
 		###
-		Creates a friendlier error message
+		Creates a friendlier error message.
 		###
 		
 		if error.code == 'NetworkingError'

			
			for reservation in result.Reservations
				for instance in reservation.Instances
					instances.push({
						id: instance.InstanceId
						state: instance.State.Name
						address: instance.PublicDnsName
					})
					
			return callback null, 'stopped' if instances.length == 0
			

				
				logsmith.debug 'selected instance', selected_instance
				
				for instance in instances
					if selected_instance != instance
						logsmith.warn "duplicate node #{node_name} with instance id #{instance_id} detected"
						
				return callback null, selected_instance.id
				
		#
