Ejemplo n.º 1
0
        public async Task <StopInstancesResponse> StopInstance(AwsUser user, string instanceId)
        {
            var client = new AmazonEC2Client(user.AccesskeyId, user.AccessKeySecret, RegionEndpoint.EUWest1);
            var result = await client.StopInstancesAsync(new StopInstancesRequest(new List <string> {
                instanceId
            }));

            return(result);
        }
Ejemplo n.º 2
0
        public async Task <IEnumerable <InstanceViewModel> > ListInstances(AwsUser user)
        {
            var client = new AmazonEC2Client(user.AccesskeyId, user.AccessKeySecret, RegionEndpoint.EUWest1);

            var response = await client.DescribeInstancesAsync();

            var instances = response.Reservations.Select(x => x.Instances.FirstOrDefault()).Where(x => x != null);

            return(MapInstances(instances));
        }