AWS code-library documentation change
Summary
Removed the 'Get started' section and all associated code examples demonstrating EC2 operations across multiple programming languages (.NET, C++, Java, JavaScript, Kotlin, Python, Ruby, Rust, Swift). Deleted examples included security group listing and instance description implementations.
Security assessment
The change removes general code examples for EC2 operations without any security-specific context. There's no evidence of vulnerability fixes, security advisories, or incident response. The examples demonstrated routine API usage (DescribeSecurityGroups/DescribeInstances) without focusing on security configurations or vulnerabilities.
Diff
diff --git a/code-library/latest/ug/ec2_code_examples.md b/code-library/latest/ug/ec2_code_examples.md index 8ad0d38cc..cb40511ee 100644 --- a//code-library/latest/ug/ec2_code_examples.md +++ b//code-library/latest/ug/ec2_code_examples.md @@ -30,717 +29,0 @@ _Scenarios_ are code examples that show you how to accomplish specific tasks by -**Get started** - -The following code examples show how to get started using Amazon EC2. - -.NET - - -**SDK for .NET (v4)** - - -###### Note - -There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/dotnetv4/EC2#code-examples). - - - namespace EC2Actions; - - public class HelloEc2 - { - /// <summary> - /// HelloEc2 lists the existing security groups for the default users. - /// </summary> - /// <param name="args">Command line arguments</param> - /// <returns>Async task.</returns> - static async Task Main(string[] args) - { - // Set up dependency injection for Amazon Elastic Compute Cloud (Amazon EC2). - using var host = Microsoft.Extensions.Hosting.Host.CreateDefaultBuilder(args) - .ConfigureServices((_, services) => - services.AddAWSService<IAmazonEC2>() - .AddTransient<EC2Wrapper>() - ) - .Build(); - - // Now the client is available for injection. - var ec2Client = host.Services.GetRequiredService<IAmazonEC2>(); - - try - { - // Retrieve information for up to 10 Amazon EC2 security groups. - var request = new DescribeSecurityGroupsRequest { MaxResults = 10 }; - var securityGroups = new List<SecurityGroup>(); - - var paginatorForSecurityGroups = - ec2Client.Paginators.DescribeSecurityGroups(request); - - await foreach (var securityGroup in paginatorForSecurityGroups.SecurityGroups) - { - securityGroups.Add(securityGroup); - } - - // Now print the security groups returned by the call to - // DescribeSecurityGroupsAsync. - Console.WriteLine("Welcome to the EC2 Hello Service example. " + - "\nLet's list your Security Groups:"); - securityGroups.ForEach(group => - { - Console.WriteLine( - $"Security group: {group.GroupName} ID: {group.GroupId}"); - }); - } - catch (AmazonEC2Exception ex) - { - Console.WriteLine($"An Amazon EC2 service error occurred while listing security groups. {ex.Message}"); - } - catch (Exception ex) - { - Console.WriteLine($"An error occurred while listing security groups. {ex.Message}"); - } - } - } - - - - * For API details, see [DescribeSecurityGroups](https://docs.aws.amazon.com/goto/DotNetSDKV4/ec2-2016-11-15/DescribeSecurityGroups) in _AWS SDK for .NET API Reference_. - - - - -C++ - - -**SDK for C++** - - -###### Note - -There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/cpp/example_code/ec2/hello_ec2#code-examples). - -Code for the CMakeLists.txt CMake file. - - - # Set the minimum required version of CMake for this project. - cmake_minimum_required(VERSION 3.13) - - # Set the AWS service components used by this project. - set(SERVICE_COMPONENTS ec2) - - # Set this project's name. - project("hello_ec2") - - # Set the C++ standard to use to build this target. - # At least C++ 11 is required for the AWS SDK for C++. - set(CMAKE_CXX_STANDARD 11) - - # Use the MSVC variable to determine if this is a Windows build. - set(WINDOWS_BUILD ${MSVC}) - - if (WINDOWS_BUILD) # Set the location where CMake can find the installed libraries for the AWS SDK. - string(REPLACE ";" "/aws-cpp-sdk-all;" SYSTEM_MODULE_PATH "${CMAKE_SYSTEM_PREFIX_PATH}/aws-cpp-sdk-all") - list(APPEND CMAKE_PREFIX_PATH ${SYSTEM_MODULE_PATH}) - endif () - - # Find the AWS SDK for C++ package. - find_package(AWSSDK REQUIRED COMPONENTS ${SERVICE_COMPONENTS}) - - if (WINDOWS_BUILD AND AWSSDK_INSTALL_AS_SHARED_LIBS) - # Copy relevant AWS SDK for C++ libraries into the current binary directory for running and debugging. - - # set(BIN_SUB_DIR "/Debug") # If you are building from the command line, you may need to uncomment this - # and set the proper subdirectory to the executables' location. - - AWSSDK_CPY_DYN_LIBS(SERVICE_COMPONENTS "" ${CMAKE_CURRENT_BINARY_DIR}${BIN_SUB_DIR}) - endif () - - add_executable(${PROJECT_NAME} - hello_ec2.cpp) - - target_link_libraries(${PROJECT_NAME} - ${AWSSDK_LINK_LIBRARIES}) - - - -Code for the hello_ec2.cpp source file. - - - #include <aws/core/Aws.h> - #include <aws/ec2/EC2Client.h> - #include <aws/ec2/model/DescribeInstancesRequest.h> - #include <iomanip> - #include <iostream> - - /* - * A "Hello EC2" starter application which initializes an Amazon Elastic Compute Cloud (Amazon EC2) client and describes - * the Amazon EC2 instances. - * - * main function - * - * Usage: 'hello_ec2' - * - */ - - int main(int argc, char **argv) { - (void)argc; - (void)argv; - - Aws::SDKOptions options; - // Optionally change the log level for debugging. - // options.loggingOptions.logLevel = Utils::Logging::LogLevel::Debug; - Aws::InitAPI(options); // Should only be called once. - int result = 0; - { - Aws::Client::ClientConfiguration clientConfig; - // Optional: Set to the AWS Region (overrides config file). - // clientConfig.region = "us-east-1"; - - Aws::EC2::EC2Client ec2Client(clientConfig); - Aws::EC2::Model::DescribeInstancesRequest request; - bool header = false; - bool done = false; - while (!done) { - Aws::EC2::Model::DescribeInstancesOutcome outcome = ec2Client.DescribeInstances(request); - if (outcome.IsSuccess()) { - if (!header) { - std::cout << std::left << - std::setw(48) << "Name" << - std::setw(20) << "ID" << - std::setw(25) << "Ami" << - std::setw(15) << "Type" << - std::setw(15) << "State" << - std::setw(15) << "Monitoring" << std::endl; - header = true; - } - - const std::vector<Aws::EC2::Model::Reservation> &reservations = - outcome.GetResult().GetReservations(); - - for (const auto &reservation: reservations) { - const std::vector<Aws::EC2::Model::Instance> &instances = - reservation.GetInstances(); - for (const auto &instance: instances) { - Aws::String instanceStateString = - Aws::EC2::Model::InstanceStateNameMapper::GetNameForInstanceStateName( - instance.GetState().GetName()); -