Amazon.Runtime.InstanceProfileAWSRegion.InstanceProfileAWSRegion C# (CSharp) Method

InstanceProfileAWSRegion() public method

Attempts to construct an instance of InstanceProfileAWSRegion. If no region is found in the metadata or we are not running on an EC2 instance an InvalidOperationException is thrown.
public InstanceProfileAWSRegion ( ) : System
return System
        public InstanceProfileAWSRegion()
        {
            var region = EC2InstanceMetadata.Region;

            if (region == null)
            {
                throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture,
                    "EC2 instance metadata was not available or did not contain region information.", AWSConfigs.AWSRegionKey));
            }

            this.Region = region;

            var logger = Logger.GetLogger(typeof(InstanceProfileAWSRegion));
            logger.InfoFormat("Region found using EC2 instance metadata.");
        }
    }
InstanceProfileAWSRegion