### Get started with Amazon EC2 Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/kotlin/services/ec2/README.md This example demonstrates how to get started with Amazon EC2. ```kotlin package com.kotlin.ec2 import android.annotation.SuppressLint import android.os.Bundle import android.util.Log import androidx.appcompat.app.AppCompatActivity import com.aws.codestar.projectred.R import com.google.android.material.snackbar.Snackbar import kotlinx.coroutines.Job import kotlinx.coroutines.launch import kotlinx.coroutines.runBlocking import software.amazon.awssdk.auth.credentials.ProfileCredentialsProvider import software.amazon.awssdk.regions.Region import software.amazon.awssdk.services.ec2.Ec2Client import software.amazon.awssdk.services.ec2.model.DescribeSecurityGroupsRequest // snippet-start:[ec2.kotlin.DescribeSecurityGroups.main] /** * Gets all security groups. * * @return The list of security groups. */ fun describeSecurityGroups(): List { val client: Ec2Client = Ec2Client.builder() .region(Region.US_EAST_1) .credentialsProvider(ProfileCredentialsProvider()) .build() val request = DescribeSecurityGroupsRequest.builder().build() val response = client.describeSecurityGroups(request) val groups = response.securityGroups() val groupNames: MutableList = mutableListOf() for (group in groups) { groupNames.add(group.groupName()) } client.close() return groupNames } class MainActivity : AppCompatActivity() { @SuppressLint("SetTextI18n") override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) val job: Job = launch { try { val groups = describeSecurityGroups() val output = "" for (group in groups) { output.plus(group) } Log.d("EC2", "Security groups: $output") Snackbar.make( findViewById(R.id.constraintLayout), "Security groups: $output", Snackbar.LENGTH_LONG ).show() } catch (e: Exception) { Log.e("EC2", "Error describing security groups", e) Snackbar.make( findViewById(R.id.constraintLayout), "Error describing security groups", Snackbar.LENGTH_LONG ).show() } } } override fun onDestroy() { super.onDestroy() } } // snippet-end:[ec2.kotlin.DescribeSecurityGroups.main] ``` -------------------------------- ### Get Started with Lambda Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/dotnetv3/Lambda/README.md A basic example to get started with AWS Lambda. This snippet demonstrates the initial setup and usage. ```csharp using System; using System.Threading.Tasks; using Lambda.Actions; namespace Lambda; /// /// Gets started with AWS Lambda. /// public class HelloLambda { // snippet-start:HelloLambda // snippet-code public static async Task Main(string[] args) { var client = new LambdaClient(); // List functions to demonstrate basic usage. await ListFunctions(client); } private static async Task ListFunctions(LambdaClient client) { var response = await client.ListFunctionsAsync(new AWS.Lambda.Model.ListFunctionsRequest()); Console.WriteLine("Functions found:"); response.Functions.ForEach(f => Console.WriteLine($" - {f.FunctionName}")); } // snippet-code // snippet-end: } ``` -------------------------------- ### Get started with OpenSearch Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/javav2/example_code/opensearch/README.md This example shows you how to get started using OpenSearch. It demonstrates the ListVersions operation. ```java // List versions // snippet-start:[opensearch.main.ListVersions] ListVersionsResponse listVersions = opensearchClient.listVersions(); System.out.println("Supported versions are: " + listVersions.versions()); // snippet-end:[opensearch.main.ListVersions] ``` -------------------------------- ### Get started with Amazon S3 Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/cpp/example_code/s3/README.md This example demonstrates how to get started using Amazon S3. ```cpp #include #include #include #include #include int main(int argc, char* argv[]) { // Initialize the AWS SDK for C++. Aws::SDKOptions options; Aws::InitAPI(options); { // Create a default S3 client. Aws::S3::S3Client s3Client; // Create a ListBucketsRequest. Aws::S3::Model::ListBucketsRequest listBucketsRequest; // Retrieve the list of buckets. Aws::S3::Model::ListBucketsOutcome listBucketsOutcome = s3Client.ListBuckets(listBucketsRequest); if (listBucketsOutcome.IsSuccess()) { std::cout << "Buckets:\n"; // Iterate over the buckets and print their names. for (const auto& bucket : listBucketsOutcome.GetResult().GetBuckets()) { std::cout << " " << bucket.GetName() << std::endl; } } else { std::cerr << "Error listing buckets: " << listBucketsOutcome.GetError().GetMessage() << std::endl; } } // Shutdown the AWS SDK for C++. Aws::ShutdownAPI(options); return 0; } ``` -------------------------------- ### Get started with AWS Systems Manager Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/javav2/example_code/ssm/README.md This example demonstrates how to get started with AWS Systems Manager by listing documents. ```java // snippet-start:[ssm.javav2.hello.HelloSSM.ListDocuments] import software.amazon.awssdk.regions.Region; import software.amazon.awssdk.services.ssm.SsmClient; import software.amazon.awssdk.services.ssm.model.ListDocumentsRequest; import software.amazon.awssdk.services.ssm.model.ListDocumentsResponse; import software.amazon.awssdk.services.ssm.model.SsmException; public class HelloSSM { public static void main(String[] args) { final String usage = "Usage:\n" + "> HelloSSM "; if (args.length != 1) { System.out.println(usage); System.exit(1); } String documentName = args[0]; SsmClient ssmClient = SsmClient.builder() .region(Region.US_EAST_1) .build(); listSSMDocuments(ssmClient, documentName); System.out.println("\nDocuments with the specified name were listed."); ssmClient.close(); } public static void listSSMDocuments(SsmClient ssmClient, String documentName) { try { ListDocumentsRequest listDocumentsRequest = ListDocumentsRequest.builder() .namePrefix(documentName) .maxResults(10) .build(); ListDocumentsResponse response = ssmClient.listDocuments(listDocumentsRequest); response.documentMetadataList().forEach(document -> System.out.printf("\nName: %s\nOwner: %s\nDocument Type: %s", document.name(), document.owner(), document.documentType())); } catch (SsmException e) { System.err.println(e.awsErrorDetails().errorMessage()); System.exit(1); } } } // snippet-end:[ssm.javav2.hello.HelloSSM.ListDocuments] ``` -------------------------------- ### Get started with Amazon EC2 Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/swift/example_code/ec2/README.md This example demonstrates how to get started with Amazon EC2 operations. ```swift import AWSClientRuntime import AWSSecurityToken import AWSEC2 func main() { let config = try! AWSClientRuntime.AWSClientRuntime.newDefaultConfiguration(region: "us-east-1") let ec2Client = try! EC2Client(config: config) Task { do { let response = try await ec2Client.describeSecurityGroups(input: DescribeSecurityGroupsInput()) print(response.securityGroups) } catch { print("Error describing security groups: \(error)") } }.`wait()` } main() ``` -------------------------------- ### Run Hello IAM Example Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/ruby/example_code/iam/README.md This example demonstrates how to get started with IAM using the AWS SDK for Ruby. It requires no specific setup beyond the SDK installation. ```ruby ruby hello/hello_iam.rb ``` -------------------------------- ### Get Started with Aurora Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/cpp/example_code/aurora/README.md This example demonstrates how to get started with Amazon Aurora. ```cpp #include #include int main(int argc, char* argv[]) { Aws::SDKOptions options; options.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Debug; Aws::InitAPI(options); { Aws::Aurora::AuroraClient auroraClient; Aws::Aurora::Model::DescribeDBClustersRequest req; auto outcome = auroraClient.DescribeDBClusters(req); if (outcome.IsSuccess()) { std::cout << "Success!" << std::endl; for (const auto& dbCluster : outcome.GetResult().GetDBClusters()) { std::cout << "\t" << dbCluster.GetDBClusterIdentifier() << std::endl; } } else { std::cout << "Error describing DB clusters: " << outcome.GetError().GetMessage() << std::endl; } } Aws::ShutdownAPI(options); return 0; } ``` -------------------------------- ### Get started with Amazon EC2 Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/javav2/example_code/ec2/README.md This example shows you how to get started using Amazon EC2. Ensure you have the necessary prerequisites. ```java /* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.example.ec2.scenario; import software.amazon.awssdk.regions.Region; import software.amazon.awssdk.services.ec2.Ec2Client; import software.amazon.awssdk.services.ec2.model.DescribeSecurityGroupsRequest; import software.amazon.awssdk.services.ec2.model.DescribeSecurityGroupsResponse; import software.amazon.awssdk.services.ec2.model.Ec2Exception; /** * Get started with Amazon EC2. * * To run this example, you need to have a default VPC and a default subnet * in your AWS account. */ public class EC2Actions { public static void main(String[] args) { final String USAGE = "\nUsage:\n" + "To run this example, you need to have a default VPC and a default subnet\n" + "in your AWS account.\n"; if (args.length != 0) { System.out.println(USAGE); System.exit(1); } Region region = Region.AWS_GLOBAL; Ec2Client ec2 = Ec2Client.builder() .region(region) .build(); describeMySecurityGroups(ec2); ec2.close(); } public static void describeMySecurityGroups(Ec2Client ec2) { try { DescribeSecurityGroupsRequest request = DescribeSecurityGroupsRequest.builder().build(); DescribeSecurityGroupsResponse response = ec2.describeSecurityGroups(request); System.out.println("Security Group details:"); response.securityGroups().forEach(sg -> { System.out.printf(" Name: %s, ID: %s, Description: %s%n", sg.groupName(), sg.groupId(), sg.description()); }); } catch (Ec2Exception e) { System.err.println(e.awsErrorDetails().errorMessage()); System.exit(1); } } } ``` -------------------------------- ### Get Started with AWS Glue (C++) Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/cpp/example_code/glue/README.md A basic example demonstrating how to get started with AWS Glue using the C++ SDK. This example is intended for initial setup and understanding. ```cmake cmake_minimum_required(VERSION 3.10) project(HelloGlue) find_package(AWSSDK REQUIRED COMPONENTS glue) add_executable(hello_glue hello_glue.cpp) target_link_libraries(hello_glue PRIVATE AWSSDK::glue) ``` ```cpp #include #include #include #include #include int main(int argc, char **argv) { Aws::SDKOptions options; options.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Debug; Aws::InitAPI(options); { Aws::Glue::GlueClient glueClient; Aws::Glue::Model::ListJobsRequest listJobsRequest; auto listJobsOutcome = glueClient.ListJobs(listJobsRequest); if (listJobsOutcome.IsSuccess()) { std::cout << "Jobs found:\n"; for (const auto &jobName : listJobsOutcome.GetResult().GetJobNames()) { std::cout << "- " << jobName << std::endl; } } else { std::cerr << "Error calling ListJobs: " << listJobsOutcome.GetError().GetMessage() << std::endl; } } Aws::ShutdownAPI(options); return 0; } ``` -------------------------------- ### Get started with MediaConvert Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/dotnetv3/MediaConvert/README.md This example demonstrates how to get started using MediaConvert by calling the DescribeEndpoints function. Ensure you have the necessary AWS SDK for .NET setup. ```csharp using System; using System.Threading.Tasks; using MediaConvert.Common; using Amazon.MediaConvert.Model; using Amazon.MediaConvert; namespace MediaConvert.Actions { /// /// Gets started with AWS Elemental MediaConvert. /// public class HelloMediaConvert { // snippet-start:DescribeEndpoints /// /// Gets the MediaConvert service endpoints. /// /// An initialized MediaConvert client. /// A list of endpoints. public static async Task> DescribeEndpointsAsync(AmazonMediaConvertClient client) { var request = new DescribeEndpointsRequest { MaxResults = 10 }; var response = await client.DescribeEndpointsAsync(request); if (response.Endpoints != null) { Console.WriteLine("Endpoints:"); foreach (var endpoint in response.Endpoints) { Console.WriteLine($"- {endpoint.Url}"); } return response.Endpoints; } else { Console.WriteLine("No endpoints found."); return new List(); } } // snippet-end:DescribeEndpoints } } ``` -------------------------------- ### Run Hello Lambda Example Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/python/example_code/lambda/README.md This example shows you how to get started using Lambda. ```python python hello/hello_lambda.py ``` -------------------------------- ### Get Started with Amazon S3 using .NET Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/dotnetv4/S3/README.md This example demonstrates the initial steps to interact with Amazon S3. It requires basic AWS SDK setup. ```csharp using Amazon.S3; using Amazon.S3.Model; // Get started with Amazon S3 // Requires the AWSSDK.S3 NuGet package. // The S3 client is used to make requests to Amazon S3. var s3Client = new AmazonS3Client(); // List buckets var response = await s3Client.ListBucketsAsync(); foreach (var bucket in response.Buckets) { Console.WriteLine($" {bucket.BucketName}"); } ``` -------------------------------- ### Run Hello Auto Scaling example Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/python/example_code/auto-scaling/README.md This example shows you how to get started using Auto Scaling. ```bash python hello/hello_autoscaling.py ``` -------------------------------- ### Run Hello IAM example Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/python/example_code/iam/README.md This example shows you how to get started using IAM. ```python python hello/hello_iam.py ``` -------------------------------- ### Run Get started with state machines example Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/python/example_code/stepfunctions/README.md This example shows you how to create an activity, create a state machine, run it, and clean up resources. Start the example by running the following at a command prompt. ```python python get_started_state_machines.py ``` -------------------------------- ### Run Hello AWS IoT Example Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/python/example_code/iot/README.md This example shows you how to get started using AWS IoT. ```shell python iot_hello.py ``` -------------------------------- ### Get started with Amazon Redshift Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/gov2/redshift/README.md This example demonstrates how to get started using Amazon Redshift. ```go package main import ( "context" "log" "github.com/aws/aws-sdk-go-v2/config" "github.com/aws/aws-sdk-go-v2/service/redshift" ) func main() { // Load the Shared AWS Configuration (~/.aws/credentials and ~/.aws/config) cfg, err := config.LoadDefaultConfig(context.TODO()) if err != nil { log.Fatalf("unable to load SDK config, %v", err) } // Using the Config value, create the Redshift client client := redshift.NewFromConfig(cfg) // Create a context and call DescribeClusters resp, err := client.DescribeClusters(context.TODO(), &redshift.DescribeClustersInput{}) if err != nil { log.Fatalf("unable to describe clusters, %v", err) } // The output of the call is in resp log.Println(resp) } ``` -------------------------------- ### Get Started with AWS Support Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/swift/example_code/support/README.md A basic example demonstrating how to get started with the AWS Support service using the SDK for Swift. ```swift import AWSClientRuntime import AWSSupport public func helloSupport() async throws { let config = try await AWSClientConfigurator.loadConfig(region: "us-east-1") let supportClient = try SupportClient(config: config) print("AWS Support client created.") // You can now use the supportClient to make API calls. // For example, to describe services: // let services = try await supportClient.describeServices(input: DescribeServicesInput()) // print(services.services ?? []) } ``` -------------------------------- ### Get Started with AWS Support using Kotlin Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/kotlin/services/support/README.md This example demonstrates how to begin using the AWS Support service with the SDK for Kotlin. It covers basic setup and initial interactions. ```kotlin package com.example.support import aws.sdk.kotlin.services.support.* import aws.sdk.kotlin.services.support.model.* import aws.sdk.kotlin.utils.IoUtils import aws.sdk.kotlin.utils.fromEnvironment import kotlin.system.exitProcess /** * Gets started with AWS Support by calling the DescribeServices action. * * This is the simplest AWS Support SDK call that you can make. * It doesn't require any parameters. */ suspend fun main() { fromEnvironment { // The AWS SDK for Kotlin uses the default AWS configuration // that is available in the environment. } val supportClient = SupportClient { // The AWS SDK for Kotlin uses the default AWS configuration // that is available in the environment. } try { val response = supportClient.describeServices { } val services = response.services if (services != null && services.isNotEmpty()) { println("Available AWS Support services:") services.forEach { service -> println(" - ${service.code} (${service.name})") } } else { println("No AWS Support services found.") } } catch (e: SupportException) { println(e.message) exitProcess(1) } } ``` -------------------------------- ### Get Started with Amazon EC2 Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/cpp/example_code/ec2/README.md A basic example demonstrating how to get started with Amazon EC2 using the AWS SDK for C++. ```cpp #include #include #include int main(int argc, char** argv) { Aws::SDKOptions options; options.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Debug; Aws::InitAPI(options); { Aws::EC2::EC2Client ec2Client; Aws::EC2::Model::DescribeSecurityGroupsRequest request; auto outcome = ec2Client.DescribeSecurityGroups(request); if (outcome.IsSuccess()) { std::cout << "Successfully described security groups." << std::endl; for (const auto& sg : outcome.GetResult().GetSecurityGroups()) { std::cout << " - " << sg.GetGroupId() << ": " << sg.GetGroupName() << std::endl; } } else { std::cerr << "Error describing security groups: " << outcome.GetError().GetMessage() << std::endl; } } Aws::ShutdownAPI(options); return 0; } ``` -------------------------------- ### Run Hello DynamoDB Example Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/ruby/example_code/dynamodb/README.md This example demonstrates how to get started with DynamoDB. Run this command to execute the 'Hello DynamoDB' example. ```ruby ruby hello/hello_dynamodb.rb ``` -------------------------------- ### Get Started with IAM Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/cpp/example_code/iam/README.md This example demonstrates how to get started with IAM operations using the AWS SDK for C++. ```cmake cmake_minimum_required(VERSION 3.8) project("hello_iam") find_package(AWSSDK REQUIRED COMPONENTS \ iam \ ) add_executable(hello_iam hello_iam/hello_iam.cpp) target_link_libraries(hello_iam PRIVATE \ PRIVATE AWSSDK::iam \ ) ``` -------------------------------- ### Run Hello Aurora example Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/python/example_code/aurora/README.md This example shows you how to get started using Aurora. ```python python hello/hello_aurora.py ``` -------------------------------- ### Get Started with DynamoDB (C++) Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/cpp/example_code/dynamodb/README.md A basic example demonstrating how to get started with DynamoDB operations using the AWS SDK for C++. ```cpp #include #include int main(int argc, char* argv[]) { Aws::SDKOptions options; Aws::InitAPI(options); { Aws::DynamoDB::DynamoDBClient dynamoDBClient; // Add DynamoDB operations here } Aws::ShutdownAPI(options); return 0; } ``` -------------------------------- ### Run Hello Amazon EC2 example Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/python/example_code/ec2/README.md This example shows how to get started using Amazon EC2. ```shell python hello/hello_ec2.py ``` -------------------------------- ### Run Hello DynamoDB Example Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/python/example_code/dynamodb/README.md This example demonstrates how to get started with DynamoDB operations. ```python python hello/hello_dynamodb.py ``` -------------------------------- ### Run Hello EventBridge Scheduler example Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/python/example_code/scheduler/README.md This example shows you how to get started using EventBridge Scheduler. ```bash python hello/hello_scheduler.py ``` -------------------------------- ### Run Learn the basics example Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/python/example_code/keyspaces/README.md This example shows you how to create a keyspace and table, connect to the keyspace, query the table, update the table, restore the table, and clean up resources. ```bash python scenario_get_started_keyspaces.py ``` -------------------------------- ### Run Learn the basics example Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/python/example_code/ec2/README.md This example demonstrates creating a key pair and security group, selecting an AMI and instance type, creating an instance, stopping and restarting it, associating an Elastic IP, connecting via SSH, and cleaning up resources. ```shell python scenario_get_started_instances.py ``` -------------------------------- ### Hello Amazon EC2 Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/ruby/example_code/ec2/README.md This example demonstrates how to get started with Amazon EC2 using the AWS SDK for Ruby. It requires no specific setup beyond having the SDK installed and configured. ```ruby require 'aws-sdk-ec2' def hello_ec2 ec2 = Aws::EC2::Client.new resp = ec2.describe_security_groups puts "Found #{resp.security_groups.count} security groups." rescue StandardError => e puts "Error describing security groups: #{e.message}" end # hello_ec2 ``` -------------------------------- ### Get Started with AWS Support Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/javav2/example_code/support/README.md This example demonstrates how to begin using the AWS Support service. ```java package com.example.support; import software.amazon.awssdk.regions.Region; import software.amazon.awssdk.services.support.SupportClient; import software.amazon.awssdk.services.support.model.DescribeServicesRequest; import software.amazon.awssdk.services.support.model.DescribeServicesResponse; import software.amazon.awssdk.services.support.model.SupportException; /** * Get started with the AWS Support service. * * To run this example, you need to configure your AWS credentials. * For more information, see "Prerequisites" in the README. */ public class HelloSupport { public static void main(String[] args) { final String usage = "\nUsage:\n" + " HelloSupport \n\n" + "Where:\n" + " - The category of the support case (e.g., general, technical, billing)."; if (args.length != 2) { System.out.println(usage); System.exit(1); } String category = args[0]; String region = args[1]; Region awsRegion = Region.of(region); SupportClient supportClient = SupportClient.builder() .region(awsRegion) .build(); try { System.out.println("Getting AWS Support services..."); DescribeServicesRequest describeServicesRequest = DescribeServicesRequest.builder() .categoryCode(category) .build(); DescribeServicesResponse response = supportClient.describeServices(describeServicesRequest); response.services().forEach(service -> { System.out.println(" " + service.code() + ": " + service.name()); }); System.out.println("\nSuccessfully retrieved AWS Support services."); } catch (SupportException e) { System.err.println(e.awsErrorDetails().errorMessage()); System.exit(1); } } } ``` -------------------------------- ### Get started with Amazon Glacier Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/dotnetv3/Glacier/README.md This example demonstrates how to get started with Amazon Glacier by listing vaults. Ensure you have the necessary AWS SDK for .NET setup. ```csharp using Amazon.Glacier; using Amazon.Glacier.Model; // Lists the vaults in your account. var client = new AmazonGlacierClient(); var response = await client.ListVaultsAsync(); foreach (var vault in response.VaultList) { Console.WriteLine($"Vault name: {vault.VaultName}"); } ``` -------------------------------- ### Run Hello Example Command Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/steering_docs/dotnet-tech/basics_scenario.md Executes the 'Hello' example. Ensure the Actions project path is correct. ```bash # Run Hello example dotnet run --project dotnetv4/{Service}/Actions/{Service}Actions.csproj ``` -------------------------------- ### Get started with CloudFormation Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/dotnetv3/CloudFormation/README.md This example demonstrates how to get started using CloudFormation by calling the DescribeStackResources API. Ensure you have the necessary AWS SDK for .NET setup. ```csharp using Amazon.CloudFormation; using Amazon.CloudFormation.Model; // Replace with your desired stack name string stackName = "MyTestStack"; var client = new AmazonCloudFormationClient(); var request = new DescribeStackResourcesRequest { StackName = stackName }; var response = await client.DescribeStackResourcesAsync(request); foreach (var resource in response.StackResources) { Console.WriteLine($"Resource Type: {resource.ResourceType}"); Console.WriteLine($"Logical ID: {resource.LogicalResourceId}"); Console.WriteLine($"Physical ID: {resource.PhysicalResourceId}"); Console.WriteLine("--------------------"); } ``` -------------------------------- ### Run the CloudFront examples Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/python/example_code/cloudfront/README.md Start the example by running the following at a command prompt. ```bash python distributions.py ``` -------------------------------- ### Get Started with Amazon RDS Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/ruby/example_code/rds/README.md This example demonstrates how to get started with Amazon RDS by calling the DescribeDBInstances API. It requires no special setup beyond having the AWS SDK for Ruby configured. ```ruby require 'aws-sdk-rds' def hello_rds rds = Aws::RDS::Client.new resp = rds.describe_db_instances puts "Found #{resp.db_instances.count} DB instances." end hello_rds ``` -------------------------------- ### Get started with Amazon Redshift using .NET Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/dotnetv4/Redshift/README.md This example demonstrates how to get started with Amazon Redshift by calling the DescribeClusters API. Ensure you have the necessary AWS SDK for .NET setup. ```csharp using System; using System.Threading.Tasks; using System.Collections.Generic; using Amazon.Redshift; using Amazon.Redshift.Model; namespace Redshift { public class HelloRedshift { // snippet-start:DescribeClusters // // Gets information about the Amazon Redshift clusters. // public static async Task DescribeClustersAsync(IAmazonRedshift redshiftClient) { try { var response = await redshiftClient.DescribeClustersAsync(new DescribeClustersRequest()); Console.WriteLine("Clusters:"); foreach (var cluster in response.Clusters) { Console.WriteLine(" - " + cluster.ClusterIdentifier); } } catch (Exception ex) { Console.WriteLine("The exception " + ex.Message + " occurred."); } } // snippet-end } } ``` -------------------------------- ### Hello AWS IoT SiteWise Example Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/sap-abap/services/ios/README.md This example demonstrates how to get started with AWS IoT SiteWise. It requires no specific setup beyond standard SDK configuration. ```ABAP METHOD hello_aws_iot_sitewise. DATA(lo_sitewise) = cl_aws_iot_sitewise=>get_instance( ). DATA(lt_asset_models) = lo_sitewise->list_asset_models( ). cl_demo_output=>display( lt_asset_models ). ENDMETHOD. ``` -------------------------------- ### Learn the basics: Create user, assume role, list S3 buckets Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/gov2/iam/README.md This example demonstrates creating a user, creating a role with S3 list permissions, attaching the role to the user, assuming the role with temporary credentials, listing S3 buckets, and cleaning up resources. ```go go run ./scenarios/scenario_assume_role.go ``` -------------------------------- ### Get started with CloudFormation using .NET Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/dotnetv4/CloudFormation/README.md This example demonstrates how to initiate your work with CloudFormation by calling the DescribeStackResources API. Ensure you have the necessary prerequisites and SDK setup. ```csharp using System; using System.Threading.Tasks; using CloudformationClient = Amazon.CloudFormation.AmazonCloudFormationClient; using Cloudformation = Amazon.CloudFormation.Model; namespace CloudformationActions { /// /// Gets started with CloudFormation. /// public class HelloCloudFormation { // /// /// Lists the resources for a stack. /// /// The name of the stack. /// An asynchronous task. public static async Task DescribeStackResourcesAsync(string stackName) { var client = new AmazonCloudFormationClient(); var request = new Cloudformation.DescribeStackResourcesRequest { StackName = stackName }; try { var response = await client.DescribeStackResourcesAsync(request); Console.WriteLine($"Resources for stack '{stackName}':"); foreach (var resource in response.StackResources) { Console.WriteLine($"- {resource.LogicalResourceId} ({resource.ResourceType})"); } } catch (Exception ex) { Console.WriteLine($"Error describing stack resources: {ex.Message}"); } } // // Example usage: // public static async Task Main(string[] args) // { // await DescribeStackResourcesAsync("YourStackName"); // } } } ``` -------------------------------- ### Install Dependencies and Start Server Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/rustv1/webassembly/README.md Installs project dependencies and starts a local development server. Access the application at http://localhost:3000. ```bash npm ci npm start ``` -------------------------------- ### Run Certificate Basics Example Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/python/example_code/acm/README.md Start the certificate basics example by running this command at a command prompt. ```bash python certificate_basics.py ``` -------------------------------- ### Hello Amazon ECS Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/dotnetv4/ECS/README.md This example demonstrates how to get started with Amazon ECS by listing available clusters. Ensure you have the necessary AWS SDK for .NET setup and credentials configured. ```csharp await ecsClient.ListClustersAsync(new ListClustersRequest()); ``` -------------------------------- ### Run Example with Scenarios Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/javascriptv3/example_code/cross-services/wkflw-resilient-service/README.md Execute the example by running this command in the project folder. Use the --scenario flag to choose between deploy, demo, or destroy operations. Optional flags include -h for help, --yes for automatic confirmation, and --verbose for detailed output. ```bash node index.js --scenario [-h|--help] [-y|--yes] [-v|--verbose] ``` -------------------------------- ### Build an example with Swift Package Manager Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/swift/example_code/cognito-identity-provider/README.md Navigate to the example's directory and use the swift build command to build it. ```bash $ swift build ``` -------------------------------- ### Get started with Amazon Inspector Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/javav2/example_code/inspector/README.md This example shows you how to get started using Amazon Inspector by listing members. ```java /* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. */ package com.java.inspector; import software.amazon.awssdk.regions.Region; import software.amazon.awssdk.services.inspector.InspectorClient; import software.amazon.awssdk.services.inspector.model.ListMembersRequest; import software.amazon.awssdk.services.inspector.model.ListMembersResponse; import software.amazon.awssdk.services.inspector.model.InspectorException; public class HelloInspector { public static void main(String[] args) { Region region = Region.US_EAST_1; InspectorClient inspectorClient = InspectorClient.builder() .region(region) .build(); listInspectorMembers(inspectorClient); } public static void listInspectorMembers(InspectorClient inspectorClient) { try { ListMembersRequest listMembersRequest = ListMembersRequest.builder() .maxResults(10) .build(); ListMembersResponse response = inspectorClient.listMembers(listMembersRequest); System.out.println("Members: " + response.memberArns()); } catch (InspectorException e) { System.err.println(e.awsErrorDetails().errorMessage()); System.exit(1); } } } ``` -------------------------------- ### Get Started with Amazon RDS Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/cpp/example_code/rds/README.md This example demonstrates the basic usage of Amazon RDS to get started with the service. ```cpp #include #include int main(int argc, char **argv) { Aws::SDKOptions options; options.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Debug; Aws::InitAPI(options); { Aws::RDS::RDSClient rdsClient; Aws::RDS::Model::DescribeDBInstancesRequest request; auto outcome = rdsClient.DescribeDBInstances(request); if (outcome.IsSuccess()) { for (const auto &dbInstance : outcome.GetResult().GetDBInstances()) { std::cout << "DB Instance Identifier: " << dbInstance.GetDBInstanceIdentifier() << std::endl; } } else { std::cerr << "Error describing DB instances: " << outcome.GetError().GetMessage() << std::endl; } } Aws::ShutdownAPI(options); return 0; } ``` -------------------------------- ### Run Hello Aurora Example Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/gov2/aurora/README.md This example demonstrates how to get started with Aurora. It requires running the command in the specified directory. ```go go run ./hello ``` -------------------------------- ### Get Started with HealthImaging Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/cpp/example_code/medical-imaging/README.md A basic example demonstrating how to get started with AWS HealthImaging using the C++ SDK. ```cpp #include #include #include int main(int argc, char** argv) { Aws::SDKOptions options; Aws::HealthImaging::HealthImagingClient client(options); Aws::HealthImaging::Model::ListDatastoresRequest request; auto outcome = client.ListDatastores(request); if (outcome.IsSuccess()) { std::cout << "Datastores found:\n"; for (const auto& datastore : outcome.GetResult().GetDatastores()) { std::cout << "- " << datastore.GetDatastoreId() << std::endl; } } else { std::cerr << "Error listing datastores: " << outcome.GetError().GetMessage() << std::endl; } return 0; } ``` -------------------------------- ### Hello Step Functions - Get Started Example Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/dotnetv3/StepFunctions/README.md A basic example demonstrating how to get started with AWS Step Functions using the SDK for .NET. It typically involves listing state machines. ```csharp ListStateMachinesResponse response = await stepFunctionsClient.ListStateMachinesAsync(new ListStateMachinesRequest()); ``` -------------------------------- ### Run Get Started Support Cases Example Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/python/example_code/support/README.md Executes the 'get_started_support_cases.py' script to learn the basics of AWS Support. ```bash python get_started_support_cases.py ``` -------------------------------- ### Get started with SageMaker Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/javav2/example_code/sagemaker/README.md This example demonstrates how to begin using Amazon SageMaker by listing notebook instances. ```java // Lists notebook instances. // snippet-start:[SageMaker.ListNotebookInstances] ListNotebookInstancesRequest listNotebookInstancesRequest = new ListNotebookInstancesRequest(); ListNotebookInstancesResponse listNotebookInstancesResponse = sageMakerClient.listNotebookInstances(listNotebookInstancesRequest); for (NotebookInstanceSummary notebookInstanceSummary : listNotebookInstancesResponse.notebookInstanceSummaries()) { System.out.println("Notebook instance ARN: " + notebookInstanceSummary.notebookInstanceArn()); } // snippet-end:[SageMaker.ListNotebookInstances] ``` -------------------------------- ### Get started with Amazon Redshift Source: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/javav2/example_code/redshift/README.md This example demonstrates how to get started using Amazon Redshift by calling the DescribeClusters API. ```java public static void main(String[] args) { } // snippet-start:DescribeClusters // snippet-end:DescribeClusters } // snippet-start:HelloRedshift public static void describeClusters(RedshiftClient redshiftClient) { try { DescribeClustersRequest clustersRequest = DescribeClustersRequest.builder() .build(); DescribeClustersResponse response = redshiftClient.describeClusters(clustersRequest); System.out.println("Clusters: " + response.clusters().size()); for (Cluster cluster : response.clusters()) { System.out.println(" " + cluster.clusterIdentifier()); } } catch (RedshiftException e) { System.err.println(e.awsErrorDetails().errorMessage()); System.exit(1); } } // snippet-end:HelloRedshift ```