<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Swapnil Pawar</title>
    <description>The latest articles on Forem by Swapnil Pawar (@spawar1991).</description>
    <link>https://forem.com/spawar1991</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F615788%2F1873d044-cfc6-4037-907d-c23245e98b59.png</url>
      <title>Forem: Swapnil Pawar</title>
      <link>https://forem.com/spawar1991</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/spawar1991"/>
    <language>en</language>
    <item>
      <title>Manage Private EC2 Instances Without Internet Access Using AWS Systems Manager</title>
      <dc:creator>Swapnil Pawar</dc:creator>
      <pubDate>Thu, 27 Jan 2022 17:52:12 +0000</pubDate>
      <link>https://forem.com/spawar1991/manage-private-ec2-instances-without-internet-access-using-aws-systems-manager-20bi</link>
      <guid>https://forem.com/spawar1991/manage-private-ec2-instances-without-internet-access-using-aws-systems-manager-20bi</guid>
      <description>&lt;h4&gt;
  
  
  Do you know that you can manage your private EC2 instances using AWS Systems Manager?
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Scenario:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let's say you have multiple EC2 instances deployed in your custom VPC within the private subnet.  Due to your security posture requirement, you cant manage your instances directly. You cant ssh into the EC2 instances with a private IP address space assigned to the subnet. &lt;/p&gt;

&lt;p&gt;Even with the AWS SSM Instance profile role configured and attached to the EC2 instance, you can’t directly manage the fleet of your private EC2 instances.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;How do you solve this?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Virtual Private Cloud endpoint&lt;br&gt;
An interface VPC endpoint (interface endpoint) allows you to connect to services powered by AWS PrivateLink, a technology that allows you to privately access Amazon Elastic Compute Cloud (Amazon EC2) and Systems Manager APIs by using private IP addresses. AWS PrivateLink restricts all network traffic between your managed instances, Systems Manager, and Amazon EC2 to the Amazon network. This means that your managed instances don't have access to the Internet.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Creating VPC endpoints for Systems Manager&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Use the following information to create a VPC interface and gateway endpoints for AWS Systems Manager. &lt;/p&gt;

&lt;p&gt;Amazon EC2 instances must be registered as managed instances to be managed with AWS Systems Manager. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Follow these steps:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Verify that SSM Agent is installed on the instance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create an AWS Identity and Access Management (IAM) instance profile for the Systems Manager. You can create a new role, or add the needed permissions to an existing role.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cSowJV7F--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qaajiu5ocy0fydw5dgiw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cSowJV7F--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qaajiu5ocy0fydw5dgiw.png" alt="IAM Permissions" width="800" height="413"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html#attach-iam-role"&gt;Attach the IAM role&lt;/a&gt; to your private EC2 instance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Go to EC2 console, select VPC ID and Subnet ID of your private instance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now, Go to the Networking &amp;amp; Content Delivery section, select VPC → Endpoints.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--i-dH7tar--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/igw17axfrum9sk9lkshz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--i-dH7tar--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/igw17axfrum9sk9lkshz.png" alt="VPC Endpoint Creation" width="800" height="331"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;For Service Name, select com.amazonaws.[region].ssm (for example, com.amazonaws.us-west-2.ssm). For a full list of Region codes, see Available Regions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;For VPC, choose the VPC ID for your instance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;For Subnets, choose a Subnet ID in your VPC. For high availability, choose at least two subnets from different Availability Zones within the Region.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;For Enable DNS name, select Enable for this endpoint. For more information, see &lt;a href="https://docs.aws.amazon.com/vpc/latest/userguide/vpce-interface.html#vpce-private-dns"&gt;Private DNS for interface endpoints&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9H4s9QXb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2btdrl9e8acr0yxqiis3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9H4s9QXb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2btdrl9e8acr0yxqiis3.png" alt="Security Group" width="800" height="341"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;For the Security group, select an existing security group, or create a new one. The security group must allow inbound HTTPS (port 443) traffic from the resources in your VPC that communicate with the service.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If you created a new security group, open the &lt;a href="https://console.aws.amazon.com/vpc"&gt;VPC console&lt;/a&gt;, choose Security Groups, and then select the new security group. On the Inbound Rules tab, choose Edit inbound rules. Add a rule with the following details, and then choose Save rules:&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;For Type, choose HTTPS.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;For Source, choose your VPC CIDR. For advanced configuration, you can allow specific subnets' CIDR used by your EC2 instances&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;Under the policy, You can select the default option “Full Access“ or you can also create a “Custom” policy.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DISqkMkH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xp4kh5yodzw05nerfboc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DISqkMkH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xp4kh5yodzw05nerfboc.png" alt="Custom Policy Creation" width="800" height="334"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To know more about Custom policies, &lt;a href="https://docs.aws.amazon.com/systems-manager/latest/userguide/setup-create-vpc.html#sysman-endpoint-policies"&gt;https://docs.aws.amazon.com/systems-manager/latest/userguide/setup-create-vpc.html#sysman-endpoint-policies&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Repeat step 5 with the following change:&lt;br&gt;
For Service Name, select &lt;strong&gt;com.amazonaws.[region].ec2messages&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Repeat step 5 with the following change:&lt;br&gt;
For Service Name, select &lt;strong&gt;com.amazonaws.[region].ssmmessages&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;You must do this if you want to use &lt;a href="https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager.html"&gt;Session Manager&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3iD58ndF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fbxqsujltngcgeeno5qv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3iD58ndF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fbxqsujltngcgeeno5qv.png" alt="VPC Endpoints" width="800" height="165"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;After the three endpoints are created, your instance appears in Managed Instances and can be managed using Systems Manager.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--c12VjePF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h8v1jzn1mueclv8u9urn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--c12VjePF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h8v1jzn1mueclv8u9urn.png" alt="SSM Fleet Manager" width="800" height="280"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Optional:&lt;/strong&gt; For advanced setup, create policies for VPC interface endpoints for AWS Systems Manager.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;code&gt;Note: If you have more than one subnet in the same Availability Zone, you don't need to create VPC endpoints for the extra subnets. Any other subnets within the same Availability Zone can access and use the interface.&lt;/code&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;SSM Agent requirements for instances&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;AWS Systems Manager Agent (SSM Agent) is Amazon software that can be installed and configured on an EC2 instance, an on-premises server, or a virtual machine (VM). SSM Agent makes it possible for the Systems Manager to update, manage, and configure these resources.&lt;/p&gt;

&lt;p&gt;If the Amazon Machine Image (AMI) type you choose in the first procedure doesn't come with SSM Agent preinstalled, manually install the agent on the new instance before it can be used with Systems Manager. If SSM Agent isn't installed on the existing EC2 instance you choose in the second procedure, manually install the agent on the instance before it can be used with Systems Manager.&lt;/p&gt;

&lt;p&gt;SSM Agent is installed by default on the following AMIs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Amazon Linux&lt;/li&gt;
&lt;li&gt;Amazon Linux 2&lt;/li&gt;
&lt;li&gt;Amazon Linux 2 ECS-Optimized Base AMIs&lt;/li&gt;
&lt;li&gt;macOS 10.14.x (Mojave), 10.15.x (Catalina), and 11. x (Big Sur)&lt;/li&gt;
&lt;li&gt;SUSE Linux Enterprise Server (SLES) 12 and 15&lt;/li&gt;
&lt;li&gt;Ubuntu Server 16.04, 18.04, and 20.04&lt;/li&gt;
&lt;li&gt;Windows Server 2008-2012 R2 AMIs published in November 2016 or later&lt;/li&gt;
&lt;li&gt;Windows Server 2016 and 2019&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;SSM Agent isn't installed on all AMIs based on Amazon Linux or Amazon Linux 2.&lt;/p&gt;

&lt;p&gt;For information about manually installing SSM Agent on other Linux operating systems, see Installing and configuring SSM Agent on EC2 instances for Linux.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The alternative to using a VPC endpoint is to allow outbound internet access on your managed instances. In this case, the managed instances must also allow HTTPS (port 443) outbound traffic to the following endpoints:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ssm.region.amazonaws.com&lt;/li&gt;
&lt;li&gt;ssmmessages.region.amazonaws.com&lt;/li&gt;
&lt;li&gt;ec2messages.region.amazonaws.com&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;SSM Agent initiates all connections to the Systems Manager service in the cloud. For this reason, you don't need to configure your firewall to allow inbound traffic to your instances for Systems Manager.&lt;/p&gt;

&lt;p&gt;For more information about calls to these endpoints, see Reference: ec2messages, ssmmessages, and other API operations.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>ec2</category>
      <category>devops</category>
      <category>linux</category>
    </item>
    <item>
      <title>Serverless Notification System Implementation With Step Functions Workflow</title>
      <dc:creator>Swapnil Pawar</dc:creator>
      <pubDate>Thu, 30 Dec 2021 11:25:41 +0000</pubDate>
      <link>https://forem.com/spawar1991/serverless-notification-system-implementation-with-step-functions-workflow-4li7</link>
      <guid>https://forem.com/spawar1991/serverless-notification-system-implementation-with-step-functions-workflow-4li7</guid>
      <description>&lt;h3&gt;
  
  
  &lt;strong&gt;Scenario&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;A client is running call center workloads in production and they are using “Verint“ third-party vendor system that uploads recordings (.tar) to the Amazon S3 bucket for backup and DR purposes.&lt;/p&gt;

&lt;p&gt;The third-party Verint system is creating .tar files in the backend and uploading them using an S3 bucket using a multipart processing approach. The issue that we found is that there is no way to track if any chunk of the .tar files has failed to upload to the S3 bucket.&lt;/p&gt;

&lt;p&gt;Due to that, it has created an issue from a &lt;strong&gt;Compliance point of view&lt;/strong&gt;. &lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Approach&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;To identify the root cause and possible solution in identifying the failure backups in Amazon S3, we need to check S3 server logs and then Develop and configure email alert notifications whenever there is a failure in file backup in Amazon S3.&lt;/p&gt;

&lt;p&gt;To know more about S3 Server Access logging, please check the ref link [1]&lt;/p&gt;

&lt;p&gt;To start with, we need to check S3 logs to get better visibility of the error and to analyze S3 Server Access Logs at scale, we have used Amazon Athena (Serverless Interactive Query Service) which makes it easy to analyze data in Amazon S3 using standard SQL. &lt;/p&gt;

&lt;p&gt;Athena is serverless, so there is no infrastructure to manage, and you pay only for the queries that you run.&lt;/p&gt;

&lt;p&gt;There were going to be multiple other processing steps that were going to involve so we have decided to go with Workflow Orchestration Service (AWS Step Functions) [2] to automate business processes.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;&lt;strong&gt;The analytic queries in this blog post focus on use case:&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Store file upload logs in Amazon Simple Storage Service (Amazon S3 Server Level Logging)&lt;/li&gt;
&lt;li&gt;Use Athena query Amazon Simple Storage Service (Amazon S3) server access logs&lt;/li&gt;
&lt;li&gt;Use Serverless orchestration using Step Function to Automate the Notification Workflow.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: &lt;strong&gt;This complete workflow will be run using Cloudwatch Events (CRON JOB) on a daily basis.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;Step Function Reference Workflow:&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;I have used Step Function Workflow Studio to design that makes it faster and easier to build workflows using a drag and drop interface in the AWS console.&lt;/p&gt;

&lt;p&gt;Let me show you how easy is to create a state machine using Workflow Studio. To get started, go to the Step Functions console and create a state machine. You will see an option to start designing the new state machine visually with Workflow Studio.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjjc1l0k3f9li6w6lerg1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjjc1l0k3f9li6w6lerg1.png" alt="Step Function AWS Console"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here are some of the available flow states:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Choice:&lt;/strong&gt; Adds if-then-else logic.&lt;br&gt;
&lt;strong&gt;Parallel:&lt;/strong&gt; Adds parallel branches.&lt;br&gt;
&lt;strong&gt;Map:&lt;/strong&gt; Adds a for-each loop.&lt;br&gt;
&lt;strong&gt;Wait:&lt;/strong&gt; Delays for a specific time.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn0vokjrk0uxvg1qnajdf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn0vokjrk0uxvg1qnajdf.png" alt="Step Function Workflow"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The above step function workflow is broken down step by step below:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1:&lt;/strong&gt; &lt;br&gt;
Fetch Call center Records lambda function executes Athena Query to get the daily records of S3 Server Access Logs from Athena Table. To learn more about query S3 server access logs and create table data, Check link [3]&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def lambda_handler(event, context):

    Previous_Date = datetime.datetime.strftime(datetime.datetime.now(), '%Y-%m-%d:%H:%M:%S')
    NDate = datetime.datetime.now() - datetime.timedelta(days=1)
    Next_Date = datetime.datetime.strftime(NDate, '%Y-%m-%d:%H:%M:%S')


    #Rendering Environment Variables
    AthenaDB = os.environ['athena_db']
    AthenaTable = os.environ['athena_table']
    AthenaoutputLocation = os.environ['athena_query_output']

    # number of retries
    RETRY_COUNT = 10

    #Initialize Boto3 Athena Client
    client = boto3.client('athena')

    #Query to get the records of duration when customer connected to contact center till he gets connected to an agent.
    query = """SELECT bucket_name,key,httpstatus,requestdatetime,request_uri,errorcode, count(*) as total FROM "{}"."{}" where {} != '{}' and {} {} and {} BETWEEN {} and {} GROUP BY {}, {}, {}, {}, {}, {};""".format(AthenaDB, AthenaTable, 'httpstatus', '200', 'requester', 'IS NOT NULL', "parse_datetime(requestdatetime,'dd/MMM/yyyy:HH:mm:ss Z')", "parse_datetime('"+str(Next_Date)+"','yyyy-MM-dd:HH:mm:ss')", "parse_datetime('"+str(Previous_Date)+"','yyyy-MM-dd:HH:mm:ss')", 'key', 'httpstatus', 'bucket_name', 'requestdatetime', 'request_uri', 'errorcode')
    # Executes Athena Query To Get The BSC Reports
    try:
        # Athena Query Execution
        response = client.start_query_execution(
            QueryString=query,
            QueryExecutionContext={
                'Database': AthenaDB
            },
            ResultConfiguration={
                "EncryptionConfiguration": {
                    "EncryptionOption": "SSE_S3"
                },
                'OutputLocation': AthenaoutputLocation
            }
        )
        if response:
            print("Successfully Executed:"+ response['QueryExecutionId'])
            # get query execution id
            query_execution_id = response['QueryExecutionId']
            print(query_execution_id)

            # get execution status
            for i in range(1, 1 + RETRY_COUNT):

                # get query execution
                query_status = client.get_query_execution(QueryExecutionId=query_execution_id)
                query_execution_status = query_status['QueryExecution']['Status']['State']

                if query_execution_status == 'SUCCEEDED':
                    print("STATUS:" + query_execution_status)
                    break

                if query_execution_status == 'FAILED':
                    raise Exception("STATUS:" + query_execution_status)

                else:
                    print("STATUS:" + query_execution_status)
                    time.sleep(i)
            else:
                client.stop_query_execution(QueryExecutionId=query_execution_id)
                raise Exception('TIME OVER')
            return response
        else:
            return build_internal_error_response("Unexpected error while completing Athena Start Execution API request", str(ex))    
    except Exception as ex:
        print(ex)
        return build_error_response('Customer error while making API request', str(ex))

def build_internal_error_response(internal_error_message, internal_error_details=None):
    return build_error_response(internal_error_message, internal_error_details, 'InternalError', 'InternalError')

def build_error_response(internal_error_message, internal_error_details=None, customer_error_code=None, customer_error_message=None):
    error_response = {
        'internalErrorMessage': internal_error_message,
        'internalErrorDetails': internal_error_details,
        'customerErrorMessage': customer_error_message,
        'customerErrorCode': customer_error_code
    }
    print(error_response)
    return error_response

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 2:&lt;/strong&gt; Added Wait Stage to give Athena query a little time to finish query and upload results to S3 bucket.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3:&lt;/strong&gt; Athena query created a results file name by QueryExecutionId so We are getting Query Execution Id to identity S3 Object in a later state.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo3rrar94y0k2zczrd97h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo3rrar94y0k2zczrd97h.png" alt="Athena GetQueryExecution"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4:&lt;/strong&gt; Added choice state to execute based on Success or Failed response.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 5:&lt;/strong&gt; If Succeded, Based on QueryExecutionId, we are getting a results file from S3.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 6 &amp;amp; 7:&lt;/strong&gt; We are using SES( Simple Email Service) to send email notifications. Since This is a sandbox env of SES, we have verified few identities and getting only verified identities list (In case there are any pending, failed status identities)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwk0riezhjhf75cdc1tzd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwk0riezhjhf75cdc1tzd.png" alt="SES Identities"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyxoekzsc3b8oahny2jsc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyxoekzsc3b8oahny2jsc.png" alt="SES GetIdentity Verification Attributes"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 8:&lt;/strong&gt; Created another “Process-***-Records” Lambda function to build up SES email functionality and get the S3 object as an attachment in the email which contains records that are failed to upload to S3.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 9:&lt;/strong&gt; If SES failed to send an email, Sys Admin will be notified of the error to track down the issue.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 10:&lt;/strong&gt; If successful execution, it will be in a Success state otherwise will be in the Failed state.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;References:&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;[1] &lt;a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/ServerLogs.html" rel="noopener noreferrer"&gt;Logging requests using server access logging - Amazon Simple Storage Service&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;[2] &lt;a href="https://aws.amazon.com/step-functions" rel="noopener noreferrer"&gt;https://aws.amazon.com/step-functions&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;[3] &lt;a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-s3-access-logs-to-identify-requests.html" rel="noopener noreferrer"&gt;Using Amazon S3 access logs to identify requests - Amazon Simple Storage Service&lt;/a&gt;&lt;br&gt;
[4] &lt;a href="https://aws.amazon.com/premiumsupport/knowledge-center/analyze-logs-athena/" rel="noopener noreferrer"&gt;Analyze my Amazon S3 server access logs using Athena&lt;/a&gt;&lt;/p&gt;

</description>
      <category>serverless</category>
      <category>aws</category>
      <category>lambda</category>
      <category>athena</category>
    </item>
    <item>
      <title>Easily transfer large amounts of data from one Amazon S3 bucket to another bucket</title>
      <dc:creator>Swapnil Pawar</dc:creator>
      <pubDate>Fri, 24 Dec 2021 15:36:30 +0000</pubDate>
      <link>https://forem.com/spawar1991/easily-transfer-large-amounts-of-data-from-one-amazon-s3-bucket-to-another-bucket-55oc</link>
      <guid>https://forem.com/spawar1991/easily-transfer-large-amounts-of-data-from-one-amazon-s3-bucket-to-another-bucket-55oc</guid>
      <description>&lt;p&gt;Recently, while working on a project, I came across the task of moving terabytes (1 TB or more) of data from one Amazon S3 bucket to another S3 bucket.&lt;/p&gt;

&lt;p&gt;First of all, you cant copy such a large number of objects using AWS S3 Console. It's not a convenient way and it will take months to copy that data manually.&lt;/p&gt;

&lt;p&gt;For this particular use case,  I have chosen the “Parallel uploads” option using AWS Command Line Interface (AWS CLI).&lt;/p&gt;

&lt;p&gt;So, Depending on your use case, you can perform the data transfer between buckets using one of the following options:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Run parallel uploads using the AWS Command Line Interface (AWS CLI)&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Use an AWS SDK&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Use cross-Region replication or same-Region replication&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Use Amazon S3 batch operations&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Use S3DistCp with Amazon EMR&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Use AWS DataSync&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Resolution:&lt;/strong&gt;
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Run parallel uploads using the AWS CLI
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; As a best practice, be sure that you're using the most recent version of the AWS CLI. For more information, see Installing the AWS CLI.&lt;/p&gt;

&lt;p&gt;You can split the transfer into multiple mutually exclusive operations to improve the transfer time by multi-threading. For example, you can run multiple, parallel instances of aws s3 cp, aws s3 mv, or aws s3 sync using the AWS CLI. &lt;/p&gt;

&lt;p&gt;You can create more upload threads while using the --exclude and --include parameters for each instance of the AWS CLI. These parameters filter operations by file name.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: The --exclude and --include parameters are processed on the client side. Because of this, the resources of your local machine might affect the performance of the operation.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For example, to copy a large amount of data from one bucket to another where all the file names begin with a test, you can run the following commands on two instances of the AWS CLI. First, run this command to copy the files with names that begin with the text “logs”:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;s3://samplebucket-logs/ s3://sampledestbucket-logs/test --recursive --exclude "*" --include "logs2019-09-16*" --profile profile1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note: If you receive errors when running AWS CLI commands, make sure that you’re using the most recent version of the AWS CLI.&lt;/p&gt;

&lt;p&gt;Then, run this command to copy the files with names that begin with the different dates for eg. 2021-04-02 and 2021-04-03:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;s3://samplebucket-logs/ s3://sampledestbucket-logs/logs-audit-april-2021/ --recursive --exclude "*" --include "logs2021-04-02*" --include "logs2021-04-03*" --profile profile1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Additionally, you can customize the following AWS CLI configurations to speed up the data transfer:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;multipart_chunksize:&lt;/strong&gt; This value sets the size of each part that the AWS CLI uploads in a multipart upload for an individual file. This setting allows you to break down a larger file (for example, 300 MB) into smaller parts for quicker upload speeds.&lt;br&gt;
Note: A multipart upload requires that a single file is uploaded in not more than 10,000 distinct parts. You must be sure that the chunk size that you set balances the part file size and the number of parts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;max_concurrent_requests:&lt;/strong&gt; This value sets the number of requests that can be sent to Amazon S3 at a time. The default value is 10. You can increase it to a higher value like 50.&lt;br&gt;
Note: Running more threads consumes more resources on your machine. You must be sure that your machine has enough resources to support the maximum amount of concurrent requests that you want.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Read more about --exclude and --include filters and how to use them: &lt;a href="https://docs.aws.amazon.com/cli/latest/reference/s3/index.html#use-of-exclude-and-include-filters"&gt;https://docs.aws.amazon.com/cli/latest/reference/s3/index.html#use-of-exclude-and-include-filters&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h4&gt;
  
  
  &lt;strong&gt;Use an AWS SDK&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Consider building a custom application using an AWS SDK to perform the data transfer for a very large number of objects. While the AWS CLI can perform the copy operation, a custom application might be more efficient at performing a transfer at the scale of hundreds of millions of objects.&lt;/p&gt;
&lt;h4&gt;
  
  
  &lt;strong&gt;Use cross-Region replication or same-Region replication&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;After you set up cross-Region replication (CRR) or same-Region replication (SRR) on the source bucket, Amazon S3 automatically and asynchronously replicates new objects from the source bucket to the destination bucket. You can choose to filter which objects are replicated using a prefix or tag. For more information on configuring replication and specifying a filter, see the Replication configuration overview.&lt;/p&gt;

&lt;p&gt;After replication is configured, only new objects are replicated to the destination bucket. Existing objects aren't replicated to the destination bucket. To replicate existing objects, you can run the following cp command after setting up replication on the source bucket:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aws s3 cp s3://samplebucket-logs s3://sampledestbucket-logs --recursive --storage-class STANDARD
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command copies objects in the source bucket back into the source bucket, which triggers replication to the destination bucket.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: It's a best practice to test the cp command in a non-production environment. Doing so allows you to configure the parameters for your exact use case.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Use Amazon S3 batch operations&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;You can use Amazon S3 batch operations to copy multiple objects with a single request. When you create a batch operation job, you specify which objects to perform the operation on using an Amazon S3 inventory report. Or, you can use a CSV manifest file to specify a batch job. Then, Amazon S3 batch operations call the API to perform the operation.&lt;/p&gt;

&lt;p&gt;After the batch operation job is complete, you get a notification and you can choose to receive a completion report about the job.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Use S3DistCp with Amazon EMR&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;The S3DistCp operation on Amazon EMR can perform parallel copying of large volumes of objects across Amazon S3 buckets. S3DistCp first copies the files from the source bucket to the worker nodes in an Amazon EMR cluster. Then, the operation writes the files from the worker nodes to the destination bucket. For more guidance on using S3DistCp, see Seven tips for using S3DistCp on Amazon EMR to move data efficiently between HDFS and Amazon S3.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Important:&lt;/strong&gt; Because this option requires you to use Amazon EMR, be sure to review Amazon EMR pricing.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Use AWS DataSync&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;To move large amounts of data from one Amazon S3 bucket to another bucket, perform the following steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Open the AWS DataSync console.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create a task.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create a new location for Amazon S3.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select your S3 bucket as the source location.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Update the source location configuration settings. Make sure to specify the AWS Identity Access Management (IAM) role that will be used to access your source S3 bucket.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select your S3 bucket as the destination location.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Update the destination location configuration settings. Make sure to specify the AWS Identity Access Management (IAM) role that will be used to access your S3 destination bucket.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Configure settings for your task.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Review the configuration details.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Choose to Create task.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Start your task.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;References:&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://aws.amazon.com/premiumsupport/knowledge-center/s3-large-transfer-between-buckets/"&gt;https://aws.amazon.com/premiumsupport/knowledge-center/s3-large-transfer-between-buckets/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>s3</category>
      <category>aws</category>
      <category>storage</category>
      <category>datasync</category>
    </item>
    <item>
      <title>Configuration As Code Using Amazon EC2 Systems Manager</title>
      <dc:creator>Swapnil Pawar</dc:creator>
      <pubDate>Fri, 24 Dec 2021 15:19:15 +0000</pubDate>
      <link>https://forem.com/spawar1991/configuration-as-code-using-amazon-ec2-systems-manager-3iej</link>
      <guid>https://forem.com/spawar1991/configuration-as-code-using-amazon-ec2-systems-manager-3iej</guid>
      <description>&lt;p&gt;Amazon EC2 Systems Manager (SSM) lets you configure, manage and automate your AWS and on-premises resources at scale. You can perform safe and secure operations without SSH access or bastion hosts using Systems Manager Run Command, mitigate configuration drift using Systems Manager State Manager, and create an access-controlled environment with full auditing. &lt;/p&gt;

&lt;p&gt;With SSM Documents, you can author your configurations as code and enable centralized management across accounts, enforcing best practices. Systems Manager provides a number of public documents for common management scenarios, or you can create your own document for deployment.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is Configuration as Code?
&lt;/h2&gt;

&lt;p&gt;Configuration as code is the practice of managing configuration files in a repository. Config files establish the parameters and settings for applications, operating systems, etc. By managing your config files alongside your code, you can help streamline your release pipeline.&lt;/p&gt;

&lt;h2&gt;
  
  
  Benefits of Using Configuration as Code?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Scalability&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Maintaining configuration changes as code allows to edit, update and create from the central location using a consistent deployment strategy.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Standardization&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When you write configuration as code, you can implement other operations like testing, scanning, and linting. Having config files reviewed and tested before they are committed ensures that changes follow your team’s standards. If you have a complex microservices architecture, this can keep your configurations stable and consistent. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Traceability&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;By storing configuration as code in the repository, we get the benefit of tracking changes in code and config files. If a bug does slip in, you have the ability to trace the source of the problem. You can diff the versioned config files to see what went wrong and fix it quickly.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Configuration As Code acts as a Single Source of Truth for your build pipeline.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Other things you can do :
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;Execute various types of scripts&lt;/em&gt; written in Python, Ruby, or PowerShell. You can also run configurations such as Ansible playbooks. You can pretty much-run anything on your instances as long as the software (e.g., Python 3.8 or Ansible) is installed on your instance and recognized by Shell on Linux and PowerShell on Windows.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;Download scripts&lt;/em&gt; stored in private or public GitHub repositories, or on Amazon S3 onto your instances for execution.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;Run multiple files&lt;/em&gt; by downloading a complete GitHub directory or an S3 bucket.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Use Case:
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Find the AWS-RunRemoteScript document for execution&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;On the AWS SSM console, on the navigation pane at the left, under Node Management Services, choose Run Command. Choose Run a Command, and then select the &lt;em&gt;AWS-RunRemoteScript&lt;/em&gt; document and the instances you want to execute this document on (whether a list of instances or tag-queries).&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Reference the python playbook located on GitHub&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Enter the parameters for the &lt;em&gt;AWS-RunRemoteScript&lt;/em&gt; Document to reference the Ansible playbook.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Source Type: Location of the script – GitHub, S3. In this case, choose GitHub.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Source Info: Provides location information for accessing the content.  In this example, since the repository is private, you need to provide an access token from GitHub, the owner, repository, and the path to the python script. So we’ll download the script, which includes an example.py script file.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Run Python Script from private GitHub repository
&lt;/h2&gt;

&lt;p&gt;Now, I’ll show you how to execute scripts from private GitHub repositories. Let’s assume that the custom python script in this example is stored in a private GitHub repository. To access this script, you need to create a private access token on GitHub and store it in Amazon EC2 Systems Manager Parameter Store.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Create your GitHub personal access token
&lt;/h3&gt;

&lt;p&gt;Create a personal access token for your private GitHub repo to give the Systems Manager access to the playbook. Personal API tokens are a way to provide access to systems to access information from your private GitHub repository. These tokens provide limited access to a subset of repository data as well as the ability to revoke access when needed. You can create a personal access token from the information provided here and then save the token value.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Store the tokens in Parameter Store
&lt;/h3&gt;

&lt;p&gt;After creating the personal access token, go to Parameter Store on the SSM console. On the Parameter Store page (Under Application Management), create a parameter and add the token you created on GitHub here, in the Value text box.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5olkxaflbzbmyc4f31gs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5olkxaflbzbmyc4f31gs.png" alt="AWS SSM Parameter Store"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Reference the Python script located on GitHub
&lt;/h3&gt;

&lt;p&gt;Along with owner, repository, and path, we will add “tokenInfo” which refers to the example-token secure string parameter that we just created. The reference is made using the ssm-secure prefix.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvi0ahyt0t04moc5zvlzn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvi0ahyt0t04moc5zvlzn.png" alt="SSM GitHub Source Config"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;{&lt;br&gt;
    "owner": "spawar1991",&lt;br&gt;
    "repository": "AWS-SSM-Demos",&lt;br&gt;
    "getOptions": "branch:dev",&lt;br&gt;
    "path": "scripts/python",&lt;br&gt;
    "tokenInfo": "{{ssm-secure:&amp;lt;Parameter-Store-Parameter-Name&amp;gt;}}"&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Select the targets where you want to execute the script and click on the run command.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgxx066e7d46qqjccybs7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgxx066e7d46qqjccybs7.png" alt="Create Run Command Operation"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx1515ibb54uq7s0pji1l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx1515ibb54uq7s0pji1l.png" alt="Create Run Command Operation"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you want to write command output to the S3 bucket or Cloudwatch Logs, under the Output options section, you can mention the log group.&lt;/p&gt;

&lt;p&gt;You can also view the Run command output in the SSM console. Go to Systems Manager → NOde Management → Run Command&lt;/p&gt;

&lt;p&gt;Click on the “Command history” Tab. Open the last run command → check Targets &amp;amp; output section&lt;/p&gt;

&lt;p&gt;Now, Click on Instance Id column and you’ll be able to see the execution steps with output and error section. You can expand each section to see the output.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6yltvl3xcffkaoxmg09r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6yltvl3xcffkaoxmg09r.png" alt="Run Command History Output"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Conclusion&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;In this, I showed you how AWS Systems Manager is a management platform that lets you use your existing tools to manage your AWS resources and environments. I showed you how to use Systems Manager to run a Python Script on your EC2 instances from a public and private GitHub repository. Using the AWS-RunRemoteScript public document and aws:runShellScript plugins, you can run any script such as Python, Ruby, or even PowerShell scripts or modules.  &lt;/p&gt;

</description>
      <category>cloudnative</category>
      <category>devops</category>
      <category>aws</category>
      <category>github</category>
    </item>
    <item>
      <title>Google Cloud Run Combines Serverless with Containers</title>
      <dc:creator>Swapnil Pawar</dc:creator>
      <pubDate>Wed, 01 Sep 2021 13:34:26 +0000</pubDate>
      <link>https://forem.com/spawar1991/google-cloud-run-combines-serverless-with-containers-5433</link>
      <guid>https://forem.com/spawar1991/google-cloud-run-combines-serverless-with-containers-5433</guid>
      <description>&lt;p&gt;When it comes to managed Kubernetes services, Google Kubernetes Engine (GKE) is a great choice if you are looking for a container orchestration platform that offers advanced scalability and configuration flexibility. GKE gives you complete control over every aspect of container orchestration, from networking to storage, to how you set up observability—in addition to supporting stateful application use cases. &lt;/p&gt;

&lt;p&gt;However, if your application does not need that level of cluster configuration and monitoring, then a fully managed Cloud Run might be the right solution for you.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Cloud Run is a fully-managed compute environment for deploying and scaling serverless containerized microservices.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hClPF7Km--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vd95mnkj0b6xmthksmfx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hClPF7Km--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vd95mnkj0b6xmthksmfx.png" alt="image" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Fully managed Cloud Run is an ideal serverless platform for stateless containerized microservices that don’t require Kubernetes features like namespaces, co-location of containers in pods (sidecars), or node allocation and management.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;You must be thinking, Why Cloud Run?&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Cloud Run is a fully managed compute environment for deploying and scaling serverless HTTP containers without worrying about provisioning machines, configuring clusters, or autoscaling.&lt;/p&gt;

&lt;p&gt;The managed serverless compute platform Cloud Run provides a number of features and benefits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Easy deployment of microservices.&lt;/strong&gt; A containerized microservice can be deployed with a single command without requiring any additional service-specific configuration. Si&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Simple and unified developer experience.&lt;/strong&gt; Each microservice is implemented as a Docker image, Cloud Run’s unit of deployment. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Scalable serverless execution.&lt;/strong&gt; A microservice deployed into managed Cloud Run scales automatically based on the number of incoming requests, without having to configure or manage a full-fledged Kubernetes cluster. Managed Cloud Run scales to zero if there are no requests, i.e., uses no resources. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Support for code written in any language.&lt;/strong&gt; Cloud Run is based on containers, so you can write code in any language, using any binary and framework.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;No vendor lock-in&lt;/strong&gt; - Because Cloud Run takes standard OCI containers and implements the standard Knative Serving API, you can easily port over your applications to on-premises or any other cloud environment. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Split traffic&lt;/strong&gt; - Cloud Run enables you to split traffic between multiple revisions, so you can perform gradual rollouts such as canary deployments or blue/green deployments.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Automatic redundancy&lt;/strong&gt; - Cloud Run offers automatic redundancy so you don’t have to worry about creating multiple instances for high availability&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Cloud Run is available in two configurations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Fully managed Google Cloud Service.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Cloud Run For Anthos (s (this option deploys Cloud Run into an Anthos GKE cluster).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Cloud Run is a layer that Google built on top of Knative to simplify deploying serverless applications on the Google Cloud Platform.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Google is one of the first public cloud providers to deliver a commercial service based on the open-source Knative project. Like the way it offered a managed Kubernetes service before any other provider, Google moved fast in exposing Knative through Cloud Run to developers.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Knative has a set of building blocks for building a serverless platform on Kubernetes. But dealing with it directly doesn’t make developers efficient or productive. While it acts as the meta-platform running on the core Kubernetes infrastructure, the developer tooling and workflow are left to the platform providers.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xiBcClU2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w9lhtcyf3b1hg2qlpu4e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xiBcClU2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w9lhtcyf3b1hg2qlpu4e.png" alt="image" width="800" height="323"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;How does Cloud Run work?&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Cloud Run service can be invoked in the following ways:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HTTPS:&lt;/strong&gt; You can send HTTPS requests to trigger a Cloud Run-hosted service. Note that all Cloud Run services have a stable HTTPS URL. Some use cases include: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Custom RESTful web API&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Private microservice&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;HTTP middleware or reverse proxy for your web applications&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Prepackaged web application&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;gRPC:&lt;/strong&gt; You can use gRPC to connect Cloud Run services with other services—for example, to provide simple, high-performance communication between internal microservices. gRPC is a good option when you: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Want to communicate between internal microservices&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Support high data loads (gRPC uses protocol buffers, which are up to seven times faster than REST calls)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Need only a simple service definition you don't want to write a full client library&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use streaming gRPCs in your gRPC server to build more responsive applications and APIs&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;WebSockets:&lt;/strong&gt; WebSockets applications are supported on Cloud Run with no additional configuration required. Potential use cases include any application that requires a streaming service, such as a chat application.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Trigger from Pub/Sub:&lt;/strong&gt; You can use Pub/Sub to push messages to the endpoint of your Cloud Run service, where the messages are subsequently delivered to containers as HTTP requests. Possible use cases include:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Transforming data after receiving an event upon a file upload to a Cloud Storage bucket&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Processing your Google Cloud operations suite logs with Cloud Run by exporting them to Pub/Sub&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Publishing and processing your own custom events from your Cloud Run services&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Running services on a schedule:&lt;/strong&gt; You can use Cloud Scheduler to securely trigger a Cloud Run service on a schedule. This is similar to using cron jobs. &lt;/p&gt;

&lt;p&gt;Possible use cases include:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Performing backups on a regular basis&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Performing recurrent administration tasks, such as regenerating a sitemap or deleting old data, content, configurations, synchronizations, or revisions&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Generating bills or other documents&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Executing asynchronous tasks:&lt;/strong&gt; You can use Cloud Tasks to securely enqueue a task to be asynchronously processed by a Cloud Run service. &lt;/p&gt;

&lt;p&gt;Typical use cases include:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Handling requests through unexpected production incidents&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Smoothing traffic spikes by delaying work that is not user-facing&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Reducing user response time by delegating slow background operations, such as database updates or batch processing, to be handled by another service, &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Limiting the call rate to backend services like databases and third-party APIs&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Events from Eventrac:&lt;/strong&gt; You can trigger Cloud Run with events from more than 60 Google Cloud sources. For example:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Use a Cloud Storage event (via Cloud Audit Logs) to trigger a data processing pipeline &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use a BigQuery event (via Cloud Audit Logs) to initiate downstream processing in Cloud Run each time a job is completed&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;How is Cloud Run different from Cloud Functions?&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Cloud Run and Cloud Functions are both fully managed services that run on Google Cloud’s serverless infrastructure, auto-scale, and handle HTTP requests or events. They do, however, have some important differences:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Cloud Functions lets you deploy snippets of code (functions) written in a limited set of programming languages, while Cloud Run lets you deploy container images using the programming language of your choice. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Cloud Run also supports the use of any tool or system library from your application; Cloud Functions does not let you use custom executables. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Cloud Run offers a longer request timeout duration of up to 60 minutes, while with Cloud Functions the requests timeout can be set as high as 9 mins. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Cloud Functions only sends one request at a time to each function instance, while by default Cloud Run is configured to send multiple concurrent requests on each container instance. This is helpful to improve latency and reduce costs if you're expecting large volumes. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;If you enjoyed this article, you might also like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://services.google.com/fh/files/misc/whitepaper_serverless_at_scale_2020.pdf"&gt;Whitepaper: Serverless At Scale &lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://cloud.google.com/blog/products/serverless/3-cool-cloud-run-features-that-developers-love-and-that-you-will-too"&gt;3 cool Cloud Run features that developers love—and that you will too | Google Cloud Blog &lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://cloud.google.com/run"&gt;Cloud Run: Container to production in seconds  |  Google Cloud&lt;/a&gt; &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=DRyn--7cZWs"&gt;Serverless at Google (Cloud Next '19) &lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>containers</category>
      <category>serverless</category>
      <category>googlecloud</category>
      <category>kubernetes</category>
    </item>
    <item>
      <title>Intro to Deployment Strategies: Blue-Green, Canary, and More</title>
      <dc:creator>Swapnil Pawar</dc:creator>
      <pubDate>Thu, 26 Aug 2021 17:36:46 +0000</pubDate>
      <link>https://forem.com/spawar1991/intro-to-deployment-strategies-blue-green-canary-and-more-16f3</link>
      <guid>https://forem.com/spawar1991/intro-to-deployment-strategies-blue-green-canary-and-more-16f3</guid>
      <description>&lt;p&gt;Whether we mean to or not, software deployments look different across organizations, teams, and applications. This can make pushing the deployment button feel like playing a game of craps: you roll the dice and try to stay alive. Luckily, there are a few ways to limit the variance in success. This blog post will discuss the different strategies and practices that can help you succeed with your production deployments.&lt;/p&gt;

&lt;h2&gt;
  
  
  Deployment Strategies to Consider
&lt;/h2&gt;

&lt;p&gt;Deployment strategies are practices used to change or upgrade a running instance of an application. The following sections will explain six deployment strategies. Let’s start with discussing the basic deployment.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Basic Deployment
&lt;/h3&gt;

&lt;p&gt;In a basic deployment, all nodes within a target environment are updated at the same time with a new service or artifact version. Because of this, basic deployments are not outage-proof and they slow down rollback processes or strategies. Of all the deployment strategies shared, it is the riskiest.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HoTbJlP2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cqkx6fe2f8izukigcmov.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HoTbJlP2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cqkx6fe2f8izukigcmov.png" alt="image" width="704" height="404"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros:&lt;/strong&gt;&lt;br&gt;
The benefits of this strategy are that it is simple, fast, and cheap. Use this strategy if 1) your application service is not business, mission, or revenue-critical, or 2) your deployment is to a lower environment, during off-hours, or with a service that is not in use.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cons:&lt;/strong&gt;&lt;br&gt;
Of all the deployment strategies shared, it is the riskiest and does not fall into best practices. Basic deployments are not outage-proof and do not provide for easy rollbacks.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Multi-Service Deployment
&lt;/h3&gt;

&lt;p&gt;In a multi-service deployment, all nodes within a target environment are updated with multiple new services simultaneously. This strategy is used for application services that have service or version dependencies, or if you’re deploying off-hours to resources that are not in use.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--FV3Um7E6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m5yscqnn1p11hfrdr968.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FV3Um7E6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m5yscqnn1p11hfrdr968.png" alt="image" width="707" height="404"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros:&lt;/strong&gt;&lt;br&gt;
Multi-service deployments are simple, fast, cheap, and not as risk-prone as a basic deployment.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cons:&lt;/strong&gt;&lt;br&gt;
Multi-service deployments are slow to roll back and not outage-proof. Using this deployment strategy also leads to difficulty in managing, testing, and verifying all the service dependencies.&lt;/p&gt;

&lt;h3&gt;
  
  
  Rolling Deployment
&lt;/h3&gt;

&lt;p&gt;A rolling deployment is a deployment strategy that updates running instances of an application with the new release. All nodes in a target environment are incrementally updated with the service or artifact version in integer N batches. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5WUd738C--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1a8wkng43xv1zxrp81lv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5WUd738C--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1a8wkng43xv1zxrp81lv.png" alt="image" width="703" height="404"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros:&lt;/strong&gt;&lt;br&gt;
The benefits of a rolling deployment are that it is relatively simple to roll back, less risky than a basic deployment, and the implementation is simple. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cons:&lt;/strong&gt;&lt;br&gt;
Since nodes are updated in batches, rolling deployments require services to support both new and old versions of an artifact. Verification of an application deployment at every incremental change also makes this deployment slow.&lt;/p&gt;

&lt;h3&gt;
  
  
  Blue-Green Deployment
&lt;/h3&gt;

&lt;p&gt;Blue-green deployment is a deployment strategy that utilizes two identical environments, a “blue” (aka staging) and a “green” (aka production) environment with different versions of an application or service. Quality assurance and user acceptance testing are typically done within the blue environment that hosts new versions or changes. User traffic is shifted from the green environment to the blue environment once new changes have been testing and accepted within the blue environment. You can then switch to the new environment once the deployment is successful.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qie1B2_q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s5f70y16mdnxxguj671e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qie1B2_q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s5f70y16mdnxxguj671e.png" alt="image" width="704" height="403"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros:&lt;/strong&gt;&lt;br&gt;
One of the benefits of the blue-green deployment is that it is simple, fast, well-understood, and easy to implement. Rollback is also straightforward, because you can simply flip traffic back to the old environment in case of any issues. Blue-green deployments are therefore not as risky compared to other deployment strategies.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cons:&lt;/strong&gt;&lt;br&gt;
Cost is a drawback to blue-green deployments. Replicating a production environment can be complex and expensive, especially when working with microservices. Quality assurance and user acceptance testing may not identify all of the anomalies or regressions either, and so shifting all user traffic at once can present risks. An outage or issue could also have a wide-scale business impact before a rollback is triggered, and depending on the implementation, in-flight user transactions may be lost when the shift in traffic is made.&lt;/p&gt;

&lt;h3&gt;
  
  
  Canary Deployment
&lt;/h3&gt;

&lt;p&gt;A canary deployment is a deployment strategy that releases an application or service incrementally to a subset of users. All infrastructure in a target environment is updated in small phases (e.g: 2%, 25%, 75%, 100%). A canary release is the lowest risk-prone, compared to all other deployment strategies, because of this control.  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GGxInEg---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/52hl7dzxm3tt2wyuqie0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GGxInEg---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/52hl7dzxm3tt2wyuqie0.png" alt="image" width="705" height="403"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros:&lt;/strong&gt;&lt;br&gt;
Canary deployments allow organizations to test in production with real users and use cases and compare different service versions side by side. It’s cheaper than a blue-green deployment because it does not require two production environments. And finally, it is fast and safe to trigger a rollback to a previous version of an application.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cons:&lt;/strong&gt;&lt;br&gt;
Drawbacks to canary deployments involve testing in production and the implementations needed. Scripting a canary release can be complex: manual verification or testing can take time, and the required monitoring and instrumentation for testing in production may involve additional research.&lt;/p&gt;

&lt;h3&gt;
  
  
  A/B Testing
&lt;/h3&gt;

&lt;p&gt;In A/B testing, different versions of the same service run simultaneously as “experiments” in the same environment for a period of time. Experiments are either controlled by feature flags toggling, A/B testing tools, or through distinct service deployments. It is the experiment owner’s responsibility to define how user traffic is routed to each experiment and version of an application. Commonly, user traffic is routed based on specific rules or user demographics to perform measurements and comparisons between service versions. Target environments can then be updated with the optimal service version. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4gRHqqBz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9bkayw1v18vqrcu8tfpx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4gRHqqBz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9bkayw1v18vqrcu8tfpx.png" alt="image" width="704" height="402"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;he biggest difference between A/B testing and other deployment strategies is that A/B testing is primarily focused on experimentation and exploration. While other deployment strategies deploy many versions of a service to an environment with the immediate goal of updating all nodes with a specific version, A/B testing is about testing multiple ideas vs. deploying one specific tested idea.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros:&lt;/strong&gt;&lt;br&gt;
A/B testing is a standard, easy, and cheap method for testing new features in production. And luckily, there are many tools that exist today to help enable A/B testing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cons:&lt;/strong&gt;&lt;br&gt;
The drawbacks to A/B testing involve the experimental nature of its use case. Experiments and tests can sometimes break the application, service, or user experience. Finally, scripting or automating AB tests can also be complex.&lt;/p&gt;

&lt;h3&gt;
  
  
  Which Deployment Strategy Should I Use?
&lt;/h3&gt;

&lt;p&gt;Now that we know different deployment techniques, a commonly asked question may be, which deployment strategy should I use? The answer depends on the type of application you have and your target environment.&lt;/p&gt;

&lt;p&gt;Based on conversations with Harness customers, most teams use blue-green or canary deployments for mission-critical web applications. Customers have minimal to little business impact when migrating from the blue-green deployment strategy to a canary deployment strategy. It’s also common for teams to create their strategy based on combining the strategies we shared in this blog post. For example, some customers will do multi-service canary deployments.&lt;/p&gt;

&lt;h3&gt;
  
  
  Eliminating After-Hours Deployments
&lt;/h3&gt;

&lt;p&gt;Software delivery is challenging. Anyone who has a deployment horror story can attest to this. One way that we can eliminate toil and spend time and efforts where it really matters is to leverage some deployment strategies and practices that can help with operationalizing our services.&lt;/p&gt;

&lt;p&gt;Some practices or standards to consider implementing include: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;service-specific deployment checklists&lt;/li&gt;
&lt;li&gt;Continuous Integration (CI) and Continuous Delivery (CD)&lt;/li&gt;
&lt;li&gt;Well-defined and understood environments&lt;/li&gt;
&lt;li&gt;Build automation tooling&lt;/li&gt;
&lt;li&gt;Configuration management tools&lt;/li&gt;
&lt;li&gt;Communication channels like Slack&lt;/li&gt;
&lt;li&gt;An on-call or incident response playbook&lt;/li&gt;
&lt;li&gt;Automated rollbacks&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A good portion of these practices can help with server or service downtime, software bugs, continuous feedback, and new application deployments. Aside from creating a foundation for better software delivery, there are also opportunities to leverage automation alongside our metrics and monitoring tools through the practice of Continuous verification (CV).&lt;/p&gt;

&lt;h3&gt;
  
  
  Continuous Verification
&lt;/h3&gt;

&lt;p&gt;Continuous verification utilizes data and operationalizing tool stacks to take action based on the performance and quality of application deployment. With our customers who use Harness today, CV helps them with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Deployment Verification – inside the verify step of a deployment pipeline leading to auto-rollback and manual rollback as failure strategies.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;And 24×7 Service Guard – always-on, change impact analysis that measures overall service health and correlates it with deployments.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There can be many questions about operationalizing deployments across different tools, dependencies, and environments. Automating some of these challenges away is the next generation of scaling and simplifying software delivery.&lt;/p&gt;

</description>
      <category>devops</category>
      <category>deployment</category>
      <category>automation</category>
      <category>software</category>
    </item>
    <item>
      <title>Want To Learn MLOps?</title>
      <dc:creator>Swapnil Pawar</dc:creator>
      <pubDate>Mon, 16 Aug 2021 06:44:50 +0000</pubDate>
      <link>https://forem.com/spawar1991/want-to-learn-mlops-4gj9</link>
      <guid>https://forem.com/spawar1991/want-to-learn-mlops-4gj9</guid>
      <description>&lt;p&gt;&lt;strong&gt;MLOps&lt;/strong&gt; is not a piece of cake. Especially in today’s changing environment. There are many challenges—construction, integrating, testing, releasing, deployment, and infrastructure management. You need to follow good practices and know-how to adjust to the challenges.&lt;/p&gt;

&lt;p&gt;Being an emerging field, MLOps is rapidly gaining momentum amongst Data Scientists, ML Engineers, and AI enthusiasts. Following this trend, the Continuous Delivery Foundation SIG MLOps differentiates the ML models management from traditional software engineering and suggests the following MLOps capabilities:&lt;/p&gt;

&lt;p&gt;MLOps aims to unify the release cycle for machine learning and software application release.&lt;/p&gt;

&lt;p&gt;MLOps enables automated testing of machine learning artifacts (e.g. data validation, ML model testing, and ML model integration testing)&lt;/p&gt;

&lt;p&gt;MLOps enables the application of agile principles to machine learning projects.&lt;/p&gt;

&lt;p&gt;MLOps enables supporting machine learning models and datasets to build these models as first-class citizens within CI/CD systems.&lt;/p&gt;

&lt;p&gt;MLOps reduces technical debt across machine learning models.&lt;/p&gt;

&lt;p&gt;MLOps must be a language-, framework-, platform-, and infrastructure-agnostic practice.&lt;/p&gt;

&lt;p&gt;And if you don’t learn and develop your knowledge, you’ll fall out of the loop. The right resources can help you follow the best practices, discover helpful tips, and learn about the latest trends.&lt;/p&gt;

&lt;p&gt;You don’t have to look far. Here’s your list of the best go-to resources about MLOps—books, articles, podcasts, and more. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;Let’s dive in!&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;[1] &lt;a href="https://www.oreilly.com/library/view/introducing-mlops/9781492083283/"&gt;Introducing MLOps&lt;/a&gt; from O’Reilly&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---oOAjEmA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/itygwd2ccvvi4s6g32sa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---oOAjEmA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/itygwd2ccvvi4s6g32sa.png" alt="Alt Text" width="250" height="328"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Introducing MLOps: How to Scale Machine Learning in the Enterprise is a book written by Mark Treveil and the Dataiku Team (collective authors). It introduces the key concepts of MLOps, shows how to maintain and improve ML models over time, and tackles the challenges of MLOps.&lt;/p&gt;

&lt;p&gt;The book is divided into three parts:&lt;/p&gt;

&lt;p&gt;An introduction to the topic of MLOps, how and why it has developed as a discipline, who needs to be involved to execute MLOps successfully, and what components are required.&lt;/p&gt;

&lt;p&gt;The second part follows the machine learning model life cycle, with chapters on developing models, preparing for production, deploying to production, monitoring, and governance.&lt;/p&gt;

&lt;p&gt;Provides tangible examples of how MLOps looks in companies today, so readers can understand the setup and implications in practice.&lt;/p&gt;




&lt;p&gt;[2] &lt;a href="https://www.oreilly.com/library/view/what-is-mlops/9781492093626/"&gt;What Is MLOps?&lt;/a&gt; from O’Reilly&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SvE1qXH---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tmkyrzpi5ejspftvvak7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SvE1qXH---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tmkyrzpi5ejspftvvak7.png" alt="Alt Text" width="250" height="375"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What Is MLOps? Generating Long-Term Value from Data Science &amp;amp; Machine Learning by Mark Treveil and Lynn Heidmann is a thorough report for business leaders who want to understand and learn about MLOps as a process for generating long-term value while reducing the risk associated with data science, ML, and AI projects.&lt;/p&gt;

&lt;p&gt;Here’s what the report includes:&lt;/p&gt;

&lt;p&gt;Detailed components of ML model building, including how business insights can provide value to the technical team&lt;/p&gt;

&lt;p&gt;Monitoring and iteration steps in the AI project lifecycle–and the role business plays in both processes&lt;/p&gt;

&lt;p&gt;How components of a modern AI governance strategy are intertwined with MLOps&lt;/p&gt;

&lt;p&gt;Guidelines for aligning people, defining processes, and assembling the technology necessary to get started with MLOps.&lt;/p&gt;




&lt;p&gt;[3] &lt;a href="https://cloud.google.com/solutions/machine-learning/mlops-continuous-delivery-and-automation-pipelines-in-machine-learning"&gt;Google Cloud&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;MLOps: Continuous delivery and automation pipelines in machine learning&lt;/strong&gt; is a document from Google that “discusses techniques for implementing and automating continuous integration (CI), continuous delivery (CD), and continuous training (CT) for machine learning (ML) systems.”&lt;/p&gt;

&lt;p&gt;If you’re new to MLOps, this document can be a great source of knowledge as it touches on some basic concepts. But if you’re the MLOps veteran, you’ll also find it helpful to refresh and solidify your knowledge. It can also help reliably build and operate ML systems at scale.&lt;/p&gt;




&lt;p&gt;[4] Awesome MLOps and production machine learning GitHub lists&lt;/p&gt;

&lt;p&gt;An &lt;a href="https://github.com/sindresorhus/awesome"&gt;Awesome list&lt;/a&gt; is a thematic curated catalog of resources, hosted in the form of a GitHub repository containing only a README file.&lt;/p&gt;

&lt;p&gt;In our case, two very useful lists are the &lt;a href="https://github.com/visenger/awesome-mlops"&gt;Awesome MLOps&lt;/a&gt; and the &lt;a href="https://github.com/EthicalML/awesome-production-machine-learning"&gt;Awesome Production Machine Learning&lt;/a&gt;. While the former focuses on learning resources, the latter complements it with an emphasis on tooling.&lt;/p&gt;

&lt;p&gt;These lists are useful when you already have a comprehensive view of the MLOps field and you would like to specialize in a given subdomain, such as model serving and monitoring.&lt;/p&gt;




&lt;p&gt;[5] &lt;a href="https://mlsys.stanford.edu/"&gt;Stanford MLSys Seminar Series&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Stanford MLSys Seminar Series is, as the name suggests, a series of seminars focused on machine learning and ML systems—tools and all the technology used for programming machine learning models.&lt;/p&gt;




&lt;p&gt;[6] &lt;a href="https://github.com/visenger/awesome-mlops"&gt;Awesome MLOps&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is An awesome list of references for MLOps – Machine Learning Operations from ml-ops.org&lt;/p&gt;

&lt;p&gt;It’s a list of links to numerous resources, beginning with books, articles, to communities, and many, many more. In a word—it has everything you could possibly read about MLOps. The table of contents includes among others: MLOps Papers, Talks About MLOps, Existing ML Systems, Machine Learning, Software Engineering Product Management for ML/AI, The Economics of ML/AI, Model Governance, Ethics, Responsible AI.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;References:&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://towardsdatascience.com/what-is-mlops-everything-you-must-know-to-get-started-523f2d0b8bd8"&gt;Towards Data Science&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://builtin.com/machine-learning/mlops"&gt;Road To MLOps&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://neptune.ai/blog/category/mlops"&gt;MLOps - neptune.ai&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://ml-ops.org/"&gt;ml-ops.org&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://ml-ops.org/content/references.html"&gt;ml-ops Books&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://fall2019.fullstackdeeplearning.com/"&gt;Full Stack Deep Learning &lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://towardsdatascience.com/the-3-best-free-online-resources-to-learn-mlops-54816904f485"&gt;3-best-free-online-resources-to-learn-mlops&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://neptune.ai/blog/learn-mlops-books-articles-podcasts"&gt;Where Can You Learn About MLOps? What Are the Best Books, Articles, or Podcasts to Learn MLOps? - neptune.ai&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://azure.microsoft.com/en-in/services/machine-learning/mlops/#resources"&gt;Machine Learning Operations – MLOps | Microsoft Azure&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://analyticsindiamag.com/7-best-resources-to-learn-mlops-in-2021/"&gt;7 Best Resources To Learn MLOps In 2021&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/seattledataguy/mlops-and-machine-learning-roadmap-o7p"&gt;@SeattledataGuy&lt;/a&gt;&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>operations</category>
      <category>dataengineering</category>
      <category>mlops</category>
    </item>
  </channel>
</rss>
