Developing on AWS

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

References

Key Features

AWS REST API

AWS REST API
  • Signing requests with Access Key SigV4, integrity –hash values, prevents replay attack (timestamp limit long time to arrive) 
REST API Structure
  • API Response Status codes:
    • 1xx: Informational all OK
    • 2xx: Success 
    • 3xx: Redirectional
    • 4xx: Missing or unauthorized –client error
    • 5xx: Internal Server error
  • CLI/SDK Automatic request signing, with retry logic
  • Supported Programming Languages (Amplify, Python Boto3, .NET, Java, C++, Ruby, JS, Go, Node.js, and PHP)
  • AI-powered, code suggestions, support to Programming languages, Optimized for AWS, Code responsibility, security scanner, compliance assist
  • Adds suggestions and code completions to code editing
  • Scans and detects (security vulnerabilities , resource leaks)
  • uses Amazon CodeGuro

Application Observability

  • Cloud Watch MELT: Metrics, Events, Logs, X-Ray Traces, Alarms, Analytics, and dashboards
  • AWS SAM Components
    • SAM Template Specs (single, deployable versioned entity) translated to CloudFormation Template, works in project structure
    • SAM CLI (invoke Lambda locally –debug)
  • SAM Resources AWS::Serverless::[Api, HttpApi := API Gateway | Function, LayerVersion := Lambda | SimpleTable :=DynamoDB | StateMachine:= Step Functions | Application) + CloudFormation resources
  • AWS SAM CLI Deploy Applications, Test Application locally (invoke lambda, start-api API Gateway, generate-event)
  • Lifecycle workflow (init->build->test->deploy)
  • CodeDeploy Deployment Strategies
    • CodeDeploy: [In-place: Stop -> Install -> Start :: EC2/On-Premises | Blue/Green: Traffic shift]
    • Lambda [ Canary : Traffic shift 2 x increments, Linear: Traffic shift equal increments, All-at-once: Traffic shift]

AWS Amplify

AWS Amplify capabilities

AWS SDK

  • Low Level API: full control of requests one method per operation
  • High Level API: Simplify Operations requests ex. boto3–python, one class per resource
  • API versioned, Synchronous | Asynchronous operations with wait option
  • Exception handling, with exponential backoffs retries

Integrated Development Environment (IDE)

  • AWS Toolkits: Eclipse, Rider, WebStorm, VisualStudio (code), PyCharm, Intellij, AWS Cloud9, Azure DevOps.
  • Cloud9: IDE for AWS, prepackaged,  support languages Based on EC2 (Instance Profile) or SSH, Sharable environment (Own Server environment), JVM TTL <60s
  • Configure named profiles for users --profile <user> option to use with CLI or AWS Toolkits for IDE. Also includes env variables.
  • Integrated Development Environment (IDE) for writing code
  • Feature flag and dynamic online configuration to applications
  • Create App namespace — organization structure, environment –deployment group, configuration profile [featureFlag | FreeForm]
  • own CLI API $aws appconfig
  1. Download and install latest SDK or CLI for the environment and programming language.
  2. Configure AWS CLI Access
    1. Default Credentials
      1. Obtain credentials and setup aws configure and
        $aws config <-- will create ~/.aws/credentials and config files
        $aws sts get-caller-identity
      2. Check and use the parameters populated in ~/.aws/config file
        [default]
        aws_access_key_id = AKI...EEQ
        aws_secret_access_key = XfN...pUpz
    2. Assume role
      $ aws sts assume-role --role-arn arn:aws:iam::479788010133:role/ecsworkshop-admin --role-session-name ecs-workshop-session
      Output:
      {
          "Credentials": {
              "AccessKeyId": "ASIAW7NMYBKKTL232ZCD",
              "SecretAccessKey": "IFMuort4vI47LAHWQtK/uiEe3ShB7BHjAqXqPWux",
              "SessionToken": "IQoJb..~~~..WCHg==",
              "Expiration": "2024-11-05T01:19:35+00:00"
          },
          "AssumedRoleUser": {
              "AssumedRoleId": "AROAW7NMYBKKXAILLJAVA:ecs-workshop-session",
              "Arn": "arn:aws:sts::479788010133:assumed-role/ecsworkshop-admin/ecs-workshop-session"
          }
      }
  3. Configure SDK Access
    import boto3
    # write code to connect to aws with session token
    session = boto3.Session(
        aws_access_key_id='AKIAW7...NOEEQ',
        aws_secret_access_key='XfNRY...Upz',
        aws_session_token='s3cr3t...' <-- if assume role
    )
    print(session)

 

AWS Code Family

DevOps on AWS

  • Agile Incremental Iterative approach
  • Continuous everything (fast and frequent)
  • AWS Tools (CodeCommit, CodeBuild, CodeArtifact, CodeDeploy, CodePipeline, Cloud9, AWS Config, CloudFormation, CloudWatch, X-Ray, … much more)

AWS CodeX family

  • CodeCommit: Source code repository based on Git
  • CodeBuild: fetch code from src control repository, compile, test, produce artifact, worker node for Jenkins, run on compute fleet [on-demand | queued], project in YAML format
  • CodeArtifact: Artifact Repositories and domains
  • CodeDeploy: Create App [ECS, Lambda, EC2/on-Premise], Deployments
    • Deployment Group: Type [Blue/Green | In-place], Deployments, Configurations for [EC2/on-premise:=[AllAtOnce | HalfAtOnce | OneAtATime | Custom] | for ECS/Lambda:=[Canary | Linear | AllAtOnce] –B/G has to be automated , ELB Target group,
    • Deployment: Deployment Group, Revision, Deployment failure behavior, Deployment Group Override, Rollback override plus appspec.yml — specifies how to deploy app on instances or version of Lambda
  • CodePipeline: Orchestrate and Automate CodeCommit, CodeBuild, CodeDeploy or 3rd Party tools with plugins [default | custom] actions.
  • CodeStar: Project Template (AWS Service [ Beanstalk | EC2 | Lambda], Application Type[Web App | Web Service | Static Site | Alexa | AWS Config Rule Document], Programming Language [C# | Go | HTML5 | Java | Node.js | PHP | Python | Ruby])

CodePipeline

Components of CodePipeline

  • Source Repository [CodeCommit | S3 | GitHub | GitLab | BitBucket]
  • Build [commands | CodeBuild | Jenkins ]
  • Deploy [AppConfig | CloudFormation | CodeDeploy | ElasticBeanstalk | OpsWorks | Service Catalog | Skills Kit | ECS | S3 ]

AWS CodeCommit is a version control service hosted by Amazon Web Services that you can use to privately store and manage assets (such as documents, source code, and binary files) in the cloud.

CodeBuild compiles your source code, runs unit tests, and produces artifacts that are ready to deploy. CodeBuild eliminates the need to provision, manage, and scale your own build servers. It provides prepackaged build environments for popular programming languages and build tools such as Apache Maven, Gradle, and more. You can also customize build environments in CodeBuild to use your own build tools. CodeBuild scales automatically to meet peak build requests

Code Build Components

  • Source: is the artifact repository ex. source code to build [S3 | CodeCommit, Github | GitLab | BitBucket] 
  • Build Environment: includes [Image, OS, Compute [EC2 | Lambda], Price model, and Role]
  • buildspec file : Default is buildspec.yml on root folder of the source code, can override.
  • Optional Configurations Batch, Artifacts[S3], CloudWatch.

Detect, track, and fix code security vulnerabilities anywhere in the development cycle using ML and automated reasoning

Code Catalyst how it works

Online Development Environment use AWS Resources to implement full cycle applications

Code Catalyst Studio

If you like what you see, please share it.

About the author

Leave A Reply

For the love of learning, We welcome inquiries and design courses for you!

Courses run on demand, custom designed, Please send us a note and one of our team members will reach out to you.