AWS SDK Examples

repository·main·Indexed 27 days ago

https://github.com/awsdocs/aws-doc-sdk-examples

A collection of code examples demonstrating how to use various AWS SDKs to interact with AWS services. This repository includes full application examples such as the Feedback Sentiment Analyzer (FSA), implemented in Ruby, JavaScript (v3), Java (v2), and .NET (v3), and the Photo Asset Management (PAM) application, which utilizes Amazon S3, Amazon Rekognition, Amazon DynamoDB, and AWS Lambda. Deployment for these examples is managed via the AWS Cloud Development Kit (AWS CDK).

Tokens
216.8K
Snippets
591
Records
1.2K
Agent score
94%

What's inside aws-doc-sdk-examples

  1. Overview of Amazon S3 Batch operations

    main

    This scenario demonstrates the following service operations using boto3:

    1. Create an AWS Batch computer environment: Creates an AWS Batch compute environment.
    2. Sets up a job queue: Creates a job queue that will manage the submission of jobs.
    3. Creates a job definition: Creates a job definition that specifies how the jobs should be executed.
    4. Registers a Job Definition: Registers a job definition making it available for job submissions.
    5. Submits a Batch Job: Submits a job.
    6. Checks the status of the job: Checks the status of the job.
  2. Overview of Photo Asset Manager (PAM)

    main

    The Photo Asset Management (PAM) application is an educational example that demonstrates a real-world image management workflow.

    Core Workflow:

    1. Upload: Users upload images to Amazon S3 (using S3 Intelligent-Tiering for cost optimization).
    2. Analyze: Amazon Rekognition performs label detection on the uploaded images.
    3. Store: Detected labels are stored in an Amazon DynamoDB table.
    4. Retrieve: Users can request a bundle of images matching specific labels. The system retrieves the images from S3, zips them, and provides a download link.

    Key Technologies:

    • Compute: AWS Lambda triggered by API Gateway and S3 events.
    • Authentication: Amazon Cognito for user management.
    • Frontend: A React single-page application (SPA) built with Vite and the Cloudscape design system.
  3. Overview of AWS IoT Greengrass Python examples

    main

    This directory contains Python code snippets demonstrating how to use the AWS IoT Greengrass Core SDK to:

    • Create AWS Lambda functions: For publishing MQTT messages, implementing connectors, and retrieving secrets.
    • Implement Connectors: Using connector_*.py files to demonstrate various AWS-provided Greengrass connectors.
    • Publish MQTT Messages: Using iot_data_client_*.py files to show how to use different clients for MQTT communication.
    • Access Local Resources: Using local_resource_access_volume.py to demonstrate accessing local volume resources on a Greengrass core instance.
    • Retrieve Secrets: Using secret_resource_access_*.py files to show how to retrieve secrets deployed to the AWS IoT Greengrass core.
  4. Overview of the Item Tracker application

    main
    The Item Tracker application is a decoupled web application consisting of a React frontend and a Spring Boot REST API backend. It allows users to track and report on work items using Amazon DynamoDB for data storage and Amazon Simple Email Service (Amazon SES) for reporting. The Spring Boot application uses the AWS SDK for Kotlin to perform CRUD operations on DynamoDB via a DynamoDbClient and returns JSON data to the React application.
  5. Overview of SageMaker Geospatial Pipeline Components

    main

    The geospatial pipeline scenario utilizes several AWS services to automate workflows:

    • Amazon SageMaker Pipelines: A series of interconnected steps (including AWS Lambda and callback steps) that automate machine learning workflows.
    • Vector Enrichment Job (VEJ): A specific geospatial job used in this example to process coordinates into addresses via Amazon Location Service.
    • AWS Lambda: Acts as the handler for pipeline steps, performing tasks such as starting the VEJ, processing Amazon SQS messages, and managing the export process.
    • Amazon SQS: Used to pass messages between the SageMaker pipeline and the Lambda function.
    • Amazon S3: Serves as the storage for input and output files.
    • Pipeline Parameters: Used to dynamically set S3 locations, IAM roles, and SQS queue identifiers across different pipeline runs.
  6. Overview of the SubscribePublishTranslate application

    main

    This ASP.NET MVC application demonstrates a cross-service workflow using the AWS SDK for .NET. It allows users to:

    1. Subscribe to an Amazon SNS topic: Users enter an email address, which receives a confirmation request. Once confirmed, the email is subscribed to the topic.
    2. Publish messages: Users can publish messages to the SNS topic.
    3. Translate messages: Using Amazon Translate, the application can translate the message body into a specified language before publishing it to all subscribers.
    4. List subscriptions: Users can view all currently subscribed email recipients.

    This project utilizes Amazon Simple Notification Service (Amazon SNS) for message delivery and Amazon Translate for language translation.

  7. Overview of Step Functions messenger example components

    main

    The example is composed of the following files:

    • state_definitions.py: Constructs state machine definitions as Python dictionaries (to be converted to JSON) by injecting resource identifiers from the CloudFormation stack.
    • stepfunctions_statemachine.py: Demonstrates usage of the AWS Step Functions state machine APIs.
    • stepfunctions_demo.py: The main entry point that orchestrates the creation, execution, and updating of the state machine.
    • setup.yaml: A CloudFormation template used to provision the DynamoDB table, Lambda function, SQS queue, and IAM roles.
  8. Overview of the first AWS Java web application tutorial

    main

    This tutorial guides beginner developers through building a dynamic web MVC application using the AWS SDK for Java (v2) and Spring Boot. The application allows users to submit data to an Amazon DynamoDB table, which then triggers an Amazon SNS notification to send a text message. Finally, the application is deployed to AWS Elastic Beanstalk.

    Key Technologies:

    • AWS SDK for Java (v2)
    • DynamoDB Enhanced Client: Used to map Java classes to DynamoDB tables for CRUD operations and queries.
    • Amazon SNS: Used for sending text message notifications.
    • AWS Elastic Beanstalk: Used for application deployment.
    • Spring Boot: Used for building the web model, views, and controller.
  9. Overview of the Serverless Aurora Item Tracker

    main

    This example implements an HTTP server using the AWS SDK for C++ that manages an item tracker. The application uses Amazon Aurora Serverless for data storage and Amazon Simple Email Service (Amazon SES) for sending email reports.

    Supported APIs:

    • GET /items: Query all items.
    • GET /items?archived=true: Query archived items.
    • GET /items?archived=false: Query active items.
    • GET /items/{item_id}: Query a single item.
    • POST /items: Create a new item.
    • PUT /items/{item_id}: Update an individual item.
    • PUT /items/{item_id}:archive: Move an item to archived status.
    • POST /items:report: Generate a report (accepts an email field in the body).
  10. Overview of Textract explorer components

    main

    The example consists of the following key files:

    • textract_app.py: A Tkinter application for visualizing document images and exploring the hierarchy of detected text, forms, and tables. It supports both synchronous and asynchronous Textract processes.
    • textract_demo_launcher.py: The entry point script used to deploy, demo, or destroy resources.
    • textract_wrapper.py: A wrapper providing high-level functions for Textract, Amazon S3, Amazon SNS, and Amazon SQS.
    • setup.yaml: A CloudFormation template that provisions the necessary infrastructure (S3 bucket, SNS topic, IAM role, and SQS queue).
  11. Overview of the Resilient Service CloudFormation Example

    main

    This CloudFormation example demonstrates how to build and manage a load-balanced web service designed for resilience. The architecture uses several AWS services to handle failures and demonstrate how to restructure services for improved availability:

    • Amazon EC2 Auto Scaling: Maintains a specified range of Amazon EC2 instances across multiple Availability Zones using a launch template.
    • Elastic Load Balancing (ALB): Distributes HTTP traffic, monitors instance health, and dispatches requests only to healthy instances.
    • Python Web Server: Runs on each EC2 instance to handle HTTP requests, provide recommendations, and respond to health checks.
    • Amazon DynamoDB: Acts as a simulated recommendation database that the web server queries.
    • AWS Systems Manager (SSM) Parameters: Used to control web server behavior and health check responses to simulate failures during the demonstration.

    All components are managed via the SDK for Python through an interactive command-line demo.

  12. Overview of the SageMaker geospatial pipeline architecture

    main

    The pipeline architecture integrates several AWS services to automate geospatial data processing:

    • Amazon SageMaker Pipelines: Orchestrates the workflow using interconnected steps and shared parameters.
    • AWS Lambda: Acts as the processor for both AWS Lambda steps and callback steps. The Lambda handler:
      • Starts a SageMaker Vector Enrichment Job (VEJ).
      • Processes messages from an Amazon SQS queue.
      • Starts export functions.
      • Completes the pipeline upon export completion.
    • Amazon S3: Serves as the storage layer for input and output files.
    • Pipeline Parameters: Used to dynamically set S3 locations for input/output and identifiers for IAM roles and SQS queues.