May 8, 2019

One good reason to cherish this summer - AWS Certified Solutions Architect - Professional

I am excited to share that I have successfully completed my certification on AWS Certified Solutions Architect - Professional 
Tips & Tricks for the certification exam preparation based on my experience is captured in another article.




That has automatically re-certified AWS Certified Solutions Architect - Associate too.

Tips for `AWS Certified Solution Architect - Professional` Preparation

Here is little tips & tricks on how to ace AWS Certified Solution Architect - Professional certification

Self Evaluation

and take up the Sample Questions. Never mind its absolute disappointment and disheartening :) 

Refresher

    If it has been long time since you have taken up AWS Certified Solution Architect – Associate Exam, I would suggest you to go through that course again. I followed Linux Academy at 1.5x speed including their trademark labs.

    Course Material

    • 50+ hrs AWS Certified Solution Architect - Professional - Linux Academy course sounded so exhaustive but its quite detailed. some lessons can be done with 1.5x speed too. 
    • Linux Academy - The Orion paper is a very good reference material. 
    • Linux Academy uses different set of use cases while explaining concepts and different set in labs. I would suggest to try those use cases used in concepts demo in your personal account, so you would get a better hold on the core concept.
    • Exam Readiness: It’s a free course in AWS Training which you can enroll and take it. Worth going through it 2nd time, especially before the exam. It gets struck many times but worth it.
    • Worth taking the re:Invent videos mentioned in Linux Academy course (last video)
    • Take the free courses mentioned in the Exam Guide 
      • EC2 Systems Manager 
      • Deep Dive into Amazon Elastic Block Store (EBS)
      • Deep Dive into Elastic File System (EFS)
      • Migrating and Tiering Storage to AWS

    Practise Tests

    1. Linux Academy Chapter Quiz - Final Quiz - multiple times (though it will be a good learning, the questions as well as answers are short and not anywhere in par with the real exam. I am sure they are still working on the questions)
    2. WhizLabs CSA Pro Practice Tests - Irrespective of you fail or pass go through all the answers and explanations of other choices are not right. Explanations are good.
    3. Take Dojo practice tests. Irrespective of you fail or pass go through all the answers and explanations of other choices are not right. Explanations are good.
    4. Took Practice test from Amazon 5 days before the scheduled exam and somehow got 75%. Thats when realized about the lengthy questions & long answers.
      Now I understand that reading the questions at 1.5x speed is critical to complete all questions in final exam.
    5. Continue to take practise tests for next few days and understanding the choices
    6. Finally too the exam and cleared it..

    Blogs worth reading!

    FAQs & WhitePapers


    Exam Results


    After 3 hours of exam, there is always a question on how would the result look like.. 

    Pass result: "Congratulations! You have successfully passed the AWS Certified _____ exam. You will receive an email once your detailed results are available in your AWS Certification Account."


    Fail result: "Thank you for taking the AWS Certified ______ exam. Unfortunately, you did not meet the minimum score required to pass the exam. You must wait 14 business days until your next attempt. You will receive an email once your detailed results are available in your AWS Certification Account."

    But the email will say this, which will sound scary on whether you have cleared it or not J

    Hello <your name>,
    Thank you for taking the  AWS Certified Solutions Architect - Professional exam. Within 5 business days of completing your exam, you will receive an email stating your exam results are available to view in your AWS Certification Account. At that time, your score report will also be available for download. 
    Do not reply to this email. If you have any questions about the AWS Certification program, please click here for assistance.


    Thank you. 

    March 17, 2019

    SAML 2.0 - AD Integration with WebApplication

    For any Enterprise, it is nearly impossible to maintain to set of accounts for all of their employees / users, hence AWS offers easy ways to authenticate users outside of AWS (say non-IAM users) using Identity Federation. There are 3 different ways in which this authentication can happen, viz Web Identities, SAML and Custom Identity Providers.
    In this article, we will be focusing SAML.

    What is SAML?

    Security Assertion Markup Language (SAML) is an XML-based, open-standard data format for exchanging authentication and authorization data between an identity provider and a service provider. SAML addresses the web browser single sign-on (SSO).
    The SAML specification defines three roles:
    • User
    • Service provider (SP)
    • Identity provider (IdP)
    Security Tokens contains assertions and assertions are passed in JWT format - Json Web Token from IdP to SP. Its URL-safe Base64 encoding - ideally signed for security. 


    SAML Basics



    Sample Scenario

    1. Let's assume 
      • user : bhuvana@abc.com
      • Service Provider: ABCContentMgr.com hosted in AWS
      • Identity Provider: AD Setup in ABC Enterprise
    2. User browses the web application from the service provider (SP)
    3. Web application redirects for the SSO
    4. SSO page takes the AD credentials, validates at the Identity Provider (IdP)
    5. IdP provides the identity or SAML assertion in JWT format
    6. SP gets the identity assertion from Identity Provider (IdP), this validation is done by a special URL for this application (in case of AWS resources; a special URL takes care of AWS Signin)
    7. Then SP lets the user access to their content management service web application. 

    SAML (AD) Configuration

    • Login to AD FS Server and Launch ADFS Management console
      • Edit Federation Service Properties and note down Federation Service Identifier
      • Go to Certificates -> Token Signing -> Details -> Copy the Thumbprint details
        You will these information to configure SAML provider details on the Service Provider / Application configuration side.
    • Create "Relying Party Trust" on your ADFS Server -> Create Amazon Web Services and configure
      • All that you will be mentioning here is how the AD have to trust Amazon Web Service
    • Fillin the Federation Metadata URL - > https://signin.aws.amazon.com/static/saml-metadata.xml 
      • This URL is common across AWS, you can download them and use it
    • Configure Trust Identifier
      • If you are using Cognito User Pool, this should be your Cognito User Pool Identifier. If you are using a different application, this will be a different URL.
    • Add an EndPoint
      • This is the URL which SAML provided calls back with the assertion in the JWT format.
      • In case of Cognito, this is your Cognito Authentication Domain, which is unique per region

    Service Provider Configuration

    • Federate with your SAML Provider
      • Create SAML IdP in the "Federation" Section -> Go to AWS Console -> IAM -> Identity Federation -> Create Provider,
        • Choose Provider Type as SAML 
        • Enter the provider name 
        • Provided the XML Metadate file (URL)
    • Enable your IdP / SAML Provider
      • Specify the Callback URL / SignOn which will tell SAML to come after you are authenticated
      • Optionally specify the SighOut URL as well
      • Configure certificate thumbnail if applicable

    March 16, 2019

    Amazon Kinesis Workflow

    Let's build Amazon Kinesis sample workflow with Amazon Kinesis Agent on EC2 Instance, Amazon Kinesis Stream, Amazon Kinesis Firehouse and Amazon S3 bucket.

    Read Amazon Kinesis Data Streams key-concepts before proceeding further.

    Amazon Kinesis Workflow



    Step by Step Instructions:

    • Go to AWS console; choose a region say - N.Virginia
    • Create Kinesis data stream as data_stream with 1 shard and leave rest as default
    • Create a Kinesis Forehose delivery stream named data_delivery with 
      • source as Kinesis data stream - data_stream, created in previous step
      • destination as S3 bucket - kinesis-destination
        Note: You can choose to e
    • Create an EC2 instance and setup JDK, JAVA_HOME and follow the instructions in Amazon Kinesis Agent Setup guide.
      • create a log file as /opt/applogs/web.log add some text
      • configure /etc/aws-kinesis/agent.log file with kinesis endpoint, firehose endpoint, file to be streamed and kinesisstream name 
        • kinesis.endpoint - kinesis.us-east-1.amazonaws.com
        • firehose.endpoint - firehose.us-east-1.amazonaws.com
        • filepattern - /opt/applogs*
        • kinesisstream - data_stream
    • sudo service aws-kinesis-agent <start / stop> start or stop the kinesis streaming agent.
      Once you start the agent, you will see that dat flowing through Kinesis Stream to Kinesis firehouse and then finally getting stored in the destination bucket
    Cleanup:
    • Delete S3 Bucket - kinesis-destination
    • Delete Kinesis Forehose delivery stream named data_delivery 
    • Delete Role - firehose_delivery_role
    • Delete Kinesis data stream - data_stream
    • Delete EC2 instance & the corresponding role, if you have created them as part of this workflow

    March 14, 2019

    Amazon SNS & SQS Simplified

    A overview of Amazon SNS & SQS with introduction, creating configuring & testing sample workflow using Amazon SNS, SQS & S3 through AWS Console.

    Amazon SNS


    Amazon Simple Notification Service (SNS) is a highly available, durable, secure, fully managed pub/sub messaging service that enables you to decouple microservices, distributed systems, and serverless applications. Amazon SNS provides topics for high-

    throughput, push-based, many-to-many messaging. Using Amazon SNS topics, your publisher systems can fan out messages to a large number of subscriber endpoints for parallel processing, including Amazon SQS queues, AWS Lambda functions, and HTTP/S webhooks. Additionally, SNS can be used to fan out notifications to end users using mobile push, SMS, and email. 

    Amazon SQS

    Amazon Simple Queue Service (SQS) is a fully managed message queuing service that enables you to decouple and scale microservices, distributed systems, and serverless applications. SQS eliminates the complexity and overhead associated with managing and operating message oriented middleware, and empowers developers to focus on differentiating work. Using SQS, you can send, store, and receive messages between software components at any volume, without losing messages or requiring other services to be available. Get started with SQS in minutes using the AWS console, Command Line Interface or SDK of your choice, and three simple commands.
    SQS offers two types of message queues. Standard queues offer maximum throughput, best-effort ordering, and at-least-once delivery. SQS FIFO queues are designed to guarantee that messages are processed exactly once, in the exact order that they are sent.

    What is Dead Letter Queue?
    A dead-letter queue is a queue that other (source) queues can target for messages that can't be processed (consumed) successfully. In this tutorial you learn how to create an Amazon SQS source queue and to configure a second queue as a dead-letter queue for it. For more information, see Amazon SQS Dead-Letter Queues.
    Important
    When you designate a queue to be a source queue, a dead-letter queue is not created automatically. You must first create a normal standard or FIFO queue before designating it a dead-letter queue.
    The dead-letter queue of a FIFO queue must also be a FIFO queue. Similarly, the dead-letter queue of a standard queue must also be a standard queue.

     Simple Workflow - Amazon SNS & SQS:

    Assume a scenario you are placing an order for a notebook, SNS sends an email to designated email address about the order request plus action to be taken and also adds the message to the orders content queue in SQS.

    Setup SNS Topic

    • Login to AWS Console & setup an SNS Topic named Order and two subscription for Email & Amazon SQS
    • Create a Subscription using Email protocol, configure your email id and verify the email address by clicking the Subscription link received to your email
    • Create a Subscription using Amazon SQS protocol, copy the ARN of the ContentQ that you will be creating under Setup SQS Queues

    Setup SQS Queues

    • Create a standard queue named ContentQ , leave everything to default and change message retention period to 1 day (range is 1 to 14 days).
      • Go to Permission tab of the newly created Q enable Allow Everybody for All SQS Actions (SQS:*)
      • Redrive policy will be empty at this point in time
    • Create a standard queue named ContentRedriveQ , leave everything to default and change message retention period to 5 day (range is 1 to 14 days).
      • No change to permission and redrive policy will be empty
    • Go to ContentQ, enable Dead Letter Queue and select ContentRedriveQ, leave Maximum receives as 1.
    • Testing SQS 
      • Select ContentQ -> Queue Actions -> Send a Message -> Type a message and Click Send
      • Select ContentQ -> Queue Actions -> View / Delete Messages -> Click Start polling for messages.  This action reads the message from the queue but does not send a confirmation of successful processing of the message. This turns to be failed or unprocessed category, which then falls into Dead Letter Queue. Now you will be able to see this message under ContentRedriveQ, which is mapped as a Dead Letter Queue of ContentQ.

    Testing SNS & SQS Flow

    • Go to Amazon SNS ->Topic -> Orders -> Publish Message -> Enter Subject & Message Body, leave rest to default and click `Publish Message`.
    • This message will be delivered to your configured email via Email protocol subscription to Order topic and will be delivered to SQS - ContentQ via SQS protocol subscription to Order topic.
    • Select ContentQ -> Queue Actions -> View / Delete Messages -> Click Start polling for messages.  This action reads the message from the queue but does not send a confirmation of successful processing of the message. This turns to be failed or unprocessed category, which then falls into Dead Letter Queue. Now you will be able to see this message under ContentRedriveQ, which is mapped as a Dead Letter Queue of ContentQ.


    Enhanced Workflow: Amazon S3, SNS & SQS Events:

    Now lets enhance the above workflow a bit by triggering message as part of S3 upload / put event. You will see how well the messages fan-out from SNS Topic to email & SQS queues.
    Message fan-out is nothing but broadcasting messages from one to many.

    Setup S3 Event

    • Create an S3 bucket named ordersbucket, go to Properties -> Events -> Add Notification -> Enter Details for New Event
      Event Name: ForSNSNotificaiton, Events: PUT, Send to: SNS Topic, SNS: Orders and try to save
      You will get the following error as your S3 bucket do not have permission to SNS Topic
      Unable to validate the following destination configurations. Permissions on the destination topic do not allow S3 to publish notifications from this bucket. (arn:aws:sns:us-east-1:<account id>:Orders)
    • To grant permission to the S3 bucket events to trigger SNS Topic, go to SNS Topic -> Orders -> Edit Access Policy ->
      replace the blue text by green 
    "Condition": {
            "StringEquals": {
              "AWS:SourceOwner": "<account id>"
           
    }
    "Condition": {
            "ArnLike": {
              "aws:SourceArn": "arn:aws:s3:::
     ordersbucket"
            } 

    • Now go back & Click Save for S3, it should work.
    • This configuration itself triggers the S3 event, which would sent the below email to your configured email and a message to ContentQ

    {  "Type" : "Notification",  "MessageId" : "f0c66789-543d-5527-9bfd-328a83cbd237",  "TopicArn" : "arn:aws:sns:us-east-1:544638597657:Orders",  "Subject" : "Amazon S3 Notification",  "Message" : "{\"Service\":\"Amazon S3\",\"Event\":\"s3:TestEvent\",\"Time\":\"2019-03-14T04:16:54.038Z\",\"Bucket\":\"ordersbucket\",\"RequestId\":\"37475229D2AF3B2E\",\"HostId\":\"csuC6wL1zh8now9VybrB8LUju2Nc1z1sF1C1TN0HU15tHR6KvI2x4lIBqrM9pMXiz5wgSQkgyYczk=\"}",  "Timestamp" : "2019-03-14T04:16:54.145Z",  "SignatureVersion" : "1",  "Signature" : "LBIZeIodCe6Y1Irx8ZBLifqrEPbUw+tEFAwVygDszoMDyKZSrMD5kwKsJ0kZzjuaXvOeYhdITIuwgWMNnrRJpLhH9EtlhbHV0g/GT/pDaNZb52JV6vRB8zO0de8DC2AVDgQ7TyxS7Vx6TuqBPuxsRX0mdD1H+UPxc3+1ory7UAXggcT0h7zKVQkT7BrT+9dJs8+RfUQ/1YODYNZCR0qJMHQIqUDbx4KR0KtuobZ+wTwT60hJgUYcM/13VL7cZgckMNGuYv8qNJc4hEwb591V8C5nnvx7JEksLJkP91PfQJsCzoGaGvh+UhDWmjVI6fHMZNo+zmyMe8I0sEw==",  "SigningCertURL" : "https://sns.us-east-1.amazonaws.com/SimpleNotificationService-6aad65c2f991xxxxxxxxda11f913f9.pem",  "UnsubscribeURL" : "https://sns.us-east-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-east-1:<accountid>:Orders:925ec4b2-1333-4b69-b82b-569c1eb7dd94"}

    Testing S3, SNS & SQS Flow


    • To test the whole flow upload a file into ordersbucket, which would trigger S3 PUT Event -> SNS Topic - Orders and watch the rest to happen seamlessly
    • This message will be delivered to your configured email with subject - Amazon S3 Notification via Email protocol subscription to Order topic and will be delivered to SQS - ContentQ via SQS protocol subscription to Order topic.

    • Select ContentQ -> Queue Actions -> View / Delete Messages -> Click Start polling for messages.  This action reads the message from the queue but does not send a confirmation of successful processing of the message. This turns to be failed or unprocessed category, which then falls into Dead Letter Queue. Now you will be able to see this message under ContentRedriveQ, which is mapped as a Dead Letter Queue of ContentQ.

    Cleanup

    Let's clean the resources that we have created as part of this demo
    • Delete S3 Bucket named ordersbucket
    • Delete SNS Topic Subscriptions that you created for email protocol & SQS
    • Delete SNS Topic Orders
    • Delete SQS - ContentQRedrive & ContentQ
      • You will get a waring that there are messages in the Queue, if you still want to delete. You can either choose to delete or purge the messages and then come back for deletion.