github.com/aavshr/aws-sdk-go@v1.41.3/example/service/ec2/instancesbyRegion/README.md (about)

     1  
     2  # Example  Fetch By region
     3  
     4  This is an example using the AWS SDK for Go to list ec2 instances instance state By different region . By default it fetch all running and stopped instance
     5  
     6  
     7  # Usage
     8  
     9  
    10  ```sh
    11  # To fetch the stopped and running instances of all region use below:
    12  ./filter_ec2_by_region --state running --state stopped
    13  
    14  # To fetch the stopped and running instances for region us-west-1 and eu-west-1 use below:
    15  ./filter_ec2_by_region --state running --state stopped --region us-west-1 --region=eu-west-1
    16  ```
    17  
    18  ## Sample Output
    19  
    20  ```
    21  Fetching instace details  for region: ap-south-1 with criteria:  [running][stopped]**
    22   printing instance details.....
    23  instance id i-************
    24  current State stopped
    25  done for region ap-south-1 ****
    26  
    27  
    28  
    29  Fetching instace details  for region: eu-west-2 with criteria:  [running][stopped]**
    30   There is no instance for the for region eu-west-2 with the matching Criteria: [running][stopped]
    31  done for region eu-west-2 ****
    32  ```