AWS code-library documentation change
Summary
Added multiple EC2 code examples for SAP ABAP SDK including AuthorizeSecurityGroupIngress, CreateVpc, CreateVpcEndpoint, DeleteVpc, DeleteVpcEndpoints, DescribeImages, DescribeInstanceTypes, and DescribeRouteTables operations.
Security assessment
The change adds documentation for security group configuration via AuthorizeSecurityGroupIngress, which is a security feature. However, there's no evidence of addressing a specific vulnerability. The examples demonstrate proper implementation of network security controls (security groups, VPC endpoints) which improves security posture.
Diff
diff --git a/code-library/latest/ug/sap-abap_1_ec2_code_examples.md b/code-library/latest/ug/sap-abap_1_ec2_code_examples.md index aabe3804d..f29b86e69 100644 --- a//code-library/latest/ug/sap-abap_1_ec2_code_examples.md +++ b//code-library/latest/ug/sap-abap_1_ec2_code_examples.md @@ -77,0 +78,40 @@ There's more on GitHub. Find the complete example and learn how to set up and ru +The following code example shows how to use `AuthorizeSecurityGroupIngress`. + +**SDK for SAP ABAP** + + +###### 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/sap-abap/services/ec2#code-examples). + + + " Create IP permissions for SSH access (port 22) + " iv_cidr_ip = '192.0.2.0/24' + DATA lt_ip_permissions TYPE /aws1/cl_ec2ippermission=>tt_ippermissionlist. + DATA(lo_ip_permission) = NEW /aws1/cl_ec2ippermission( + iv_ipprotocol = 'tcp' + iv_fromport = 22 + iv_toport = 22 + it_ipranges = VALUE /aws1/cl_ec2iprange=>tt_iprangelist( + ( NEW /aws1/cl_ec2iprange( iv_cidrip = iv_cidr_ip ) ) + ) + ). + APPEND lo_ip_permission TO lt_ip_permissions. + + TRY. + oo_result = lo_ec2->authsecuritygroupingress( " oo_result is returned for testing purposes. " + iv_groupid = iv_group_id + it_ippermissions = lt_ip_permissions ). + MESSAGE 'Authorized ingress rule for security group.' TYPE 'I'. + CATCH /aws1/cx_rt_service_generic INTO DATA(lo_exception). + DATA(lv_error) = |"{ lo_exception->av_err_code }" - { lo_exception->av_err_msg }|. + MESSAGE lv_error TYPE 'E'. + ENDTRY. + + + + * For API details, see [AuthorizeSecurityGroupIngress](https://docs.aws.amazon.com/sdk-for-sap-abap/v1/api/latest/index.html) in _AWS SDK for SAP ABAP API reference_. + + + + @@ -130,0 +171,58 @@ There's more on GitHub. Find the complete example and learn how to set up and ru +The following code example shows how to use `CreateVpc`. + +**SDK for SAP ABAP** + + +###### 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/sap-abap/services/ec2#code-examples). + + + " iv_cidr_block = '10.0.0.0/16' + TRY. + oo_result = lo_ec2->createvpc( iv_cidrblock = iv_cidr_block ). " oo_result is returned for testing purposes. " + DATA(lv_vpc_id) = oo_result->get_vpc( )->get_vpcid( ). + MESSAGE 'Created VPC.' TYPE 'I'. + CATCH /aws1/cx_rt_service_generic INTO DATA(lo_exception). + DATA(lv_error) = |"{ lo_exception->av_err_code }" - { lo_exception->av_err_msg }|. + MESSAGE lv_error TYPE 'E'. + ENDTRY. + + + + * For API details, see [CreateVpc](https://docs.aws.amazon.com/sdk-for-sap-abap/v1/api/latest/index.html) in _AWS SDK for SAP ABAP API reference_. + + + + +The following code example shows how to use `CreateVpcEndpoint`. + +**SDK for SAP ABAP** + + +###### 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/sap-abap/services/ec2#code-examples). + + + " iv_vpc_id = 'vpc-abc123' + " iv_service_name = 'com.amazonaws.region.service' + TRY. + oo_result = lo_ec2->createvpcendpoint( " oo_result is returned for testing purposes. " + iv_vpcid = iv_vpc_id + iv_servicename = iv_service_name + it_routetableids = it_route_table_ids ). + DATA(lv_vpc_endpoint_id) = oo_result->get_vpcendpoint( )->get_vpcendpointid( ). + MESSAGE 'Created VPC endpoint.' TYPE 'I'. + CATCH /aws1/cx_rt_service_generic INTO DATA(lo_exception). + DATA(lv_error) = |"{ lo_exception->av_err_code }" - { lo_exception->av_err_msg }|. + MESSAGE lv_error TYPE 'E'. + ENDTRY. + + + + * For API details, see [CreateVpcEndpoint](https://docs.aws.amazon.com/sdk-for-sap-abap/v1/api/latest/index.html) in _AWS SDK for SAP ABAP API reference_. + + + + @@ -180,0 +279,50 @@ There's more on GitHub. Find the complete example and learn how to set up and ru +The following code example shows how to use `DeleteVpc`. + +**SDK for SAP ABAP** + + +###### 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/sap-abap/services/ec2#code-examples). + + + TRY. + lo_ec2->deletevpc( iv_vpcid = iv_vpc_id ). + MESSAGE 'Deleted VPC.' TYPE 'I'. + CATCH /aws1/cx_rt_service_generic INTO DATA(lo_exception). + DATA(lv_error) = |"{ lo_exception->av_err_code }" - { lo_exception->av_err_msg }|. + MESSAGE lv_error TYPE 'E'. + ENDTRY. + + + + * For API details, see [DeleteVpc](https://docs.aws.amazon.com/sdk-for-sap-abap/v1/api/latest/index.html) in _AWS SDK for SAP ABAP API reference_. + + + + +The following code example shows how to use `DeleteVpcEndpoints`. + +**SDK for SAP ABAP** + + +###### 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/sap-abap/services/ec2#code-examples). + + + TRY. + lo_ec2->deletevpcendpoints( it_vpcendpointids = it_vpc_endpoint_ids ). + MESSAGE 'Deleted VPC endpoint(s).' TYPE 'I'. + CATCH /aws1/cx_rt_service_generic INTO DATA(lo_exception). + DATA(lv_error) = |"{ lo_exception->av_err_code }" - { lo_exception->av_err_msg }|. + MESSAGE lv_error TYPE 'E'. + ENDTRY. + + + + * For API details, see [DeleteVpcEndpoints](https://docs.aws.amazon.com/sdk-for-sap-abap/v1/api/latest/index.html) in _AWS SDK for SAP ABAP API reference_. + + + + @@ -234,0 +383,70 @@ There's more on GitHub. Find the complete example and learn how to set up and ru +The following code example shows how to use `DescribeImages`. + +**SDK for SAP ABAP** + + +###### 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/sap-abap/services/ec2#code-examples). + + + TRY. + oo_result = lo_ec2->describeimages( it_imageids = it_image_ids ). " oo_result is returned for testing purposes. " + DATA(lt_images) = oo_result->get_images( ). + MESSAGE 'Retrieved information about Amazon Machine Images (AMIs).' TYPE 'I'. + CATCH /aws1/cx_rt_service_generic INTO DATA(lo_exception). + DATA(lv_error) = |"{ lo_exception->av_err_code }" - { lo_exception->av_err_msg }|. + MESSAGE lv_error TYPE 'E'. + ENDTRY. + + + + * For API details, see [DescribeImages](https://docs.aws.amazon.com/sdk-for-sap-abap/v1/api/latest/index.html) in _AWS SDK for SAP ABAP API reference_. + + + + +The following code example shows how to use `DescribeInstanceTypes`. + +**SDK for SAP ABAP** + + +###### 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/sap-abap/services/ec2#code-examples). + + + " Create filters for architecture and instance type patterns + " iv_architecture = 'x86_64' + DATA lt_filters TYPE /aws1/cl_ec2filter=>tt_filterlist. + APPEND NEW /aws1/cl_ec2filter( + iv_name = 'processor-info.supported-architecture' + it_values = VALUE /aws1/cl_ec2valuestringlist_w=>tt_valuestringlist( + ( NEW /aws1/cl_ec2valuestringlist_w( iv_architecture ) ) + )