Implementation for accessing SimpleSystemsManagement Amazon EC2 Systems Manager is a collection of capabilities that helps you automate management tasks such as collecting system inventory, applying operating system (OS) patches, automating the creation of Amazon Machine Images (AMIs), and configuring operating systems (OSs) and applications at scale. Systems Manager works with managed instances: Amazon EC2 instances and servers or virtual machines (VMs) in your on-premises environment that are configured for Systems Manager.

This references is intended to be used with the EC2 Systems Manager User Guide (Linux) (Windows).

To get started, verify prerequisites and configure managed instances (Linux) (Windows).

상속: AmazonServiceClient, IAmazonSimpleSystemsManagement
예제 #1
0
        public string GetParamValue(string paramKey)
        {
            lock (_ResolveCache) {
                string paramKeyWithoutPhs = paramKey;
                foreach (var phName in this.ParameterKeyPlaceholderResolvers.Keys)
                {
                    string pt = "{" + phName + "}";
                    if (paramKeyWithoutPhs.Contains(pt))
                    {
                        string pv = this.ParameterKeyPlaceholderResolvers[phName].Invoke();
                        paramKeyWithoutPhs = paramKeyWithoutPhs.Replace(pt, pv);
                    }
                }

                if (_ResolveCache.ContainsKey(paramKeyWithoutPhs))
                {
                    return(_ResolveCache[paramKeyWithoutPhs]);
                }

                string pValue = null;
                using (var client = new AmazonSimpleSystemsManagementClient(this.AwsCredentials, this.AwsRegion)) {
                    var request = new GetParameterRequest()
                    {
                        Name = paramKeyWithoutPhs
                    };
                    var t = client.GetParameterAsync(request);
                    t.Wait();
                    if (t.IsCompleted && t.Result is object && t.Result.Parameter is object)
                    {
                        _ResolveCache.Add(paramKeyWithoutPhs, t.Result.Parameter.Value);
                        pValue = t.Result.Parameter.Value;
                    }
                }

                if (pValue is object)
                {
                    lock (_BoundObjects) {
                        foreach (var adapter in _BoundObjects.Values)
                        {
                            adapter.InjectValue(paramKey, pValue);
                            if (!((paramKeyWithoutPhs ?? "") == (paramKey ?? "")))
                            {
                                adapter.InjectValue(paramKeyWithoutPhs, pValue);
                            }
                        }
                    }
                }

                return(pValue);
            }
        }