Friday, January 29, 2021
AWS Lambda Layers
Tuesday, December 29, 2020
AWS CloudShell
AWS CloudShell is a browser-based shell that makes it easy to securely manage, explore, and interact with your AWS resources. CloudShell is pre-authenticated with your console credentials. Common development and operations tools are pre-installed, so no local installation or configuration is required. With CloudShell, you can quickly run scripts with the AWS Command Line Interface (AWS CLI), experiment with AWS service APIs using the AWS SDKs, or use a range of other tools to be productive. You can use CloudShell right from your browser and at no additional cost.
Benefits
No extra credentials to manage
CloudShell inherits the credentials of the user signed in to the AWS Management Console, so there's no need to spend extra effort managing credentials locally.
Always up to date
CloudShell provides a fully managed Amazon Linux 2 environment that has the latest versions of popular tools already installed and updated. You don't need to patch the environment or update the pre-installed tools.
No cost
CloudShell provides you with a browser-based shell to run scripts and commands. It includes 1 GB of persistent storage per Region at no extra cost to you. You only pay for the AWS resources you use with CloudShell to create and run your applications.
Customizable
With 1 GB of persistent storage per Region, you can store scripts, files, configuration preferences, and additional tools in your home directory. You can begin working immediately, without customizing your environment every time you use the shell.
Tuesday, June 11, 2019
AWS Fargate
Amazon ECS has two modes:
- Fargate launch type
- EC2 launch type
Link: https://aws.amazon.com/fargate/
Monday, April 16, 2018
Queues - RabbitMQ vs SQS
RabbitMQ supports powerful message routing via exchange. This is very important when we need to run the same job on a specific server, group of servers or all servers. Our application sends one message and exchange will route it. RabbitMQ also has vhosts so that multiple applications can share the same RabbitMQ server but be isolated from each other (we can create unique logins for separate applications to access their vhosts). RabbitMQ can be setup in clusters for redundancy / failover and will acknowledge receipt of messages.
RabbitMQ has a powerful GUI which is accessible http://localhost:15672/. Hosting for RabbitMQ offers fewer choices and is more expensive.
AWS SQS
AWS SQS takes care of managing our queues. AWS SDK offers low level access but shoryuken is a higher level integration (shoryuken author acknowledges sidekiq as inspiration). Retrying failed jobs will happen automatically unless the messages is explicitly deleted. We can only delay jobs for 15 minutes (or we get The maximum allowed delay is 15 minutes (RuntimeError)). Recurring jobs are not supported but there are workarounds with AWS lambda and CloudWatch. AWS SQS UI is decent and we can use AWS SDK to access data directly. SQS has other interesting features such as long polling, batch operations and dead letter queues. SQS also has FIFO queues which guarantee he order in which messages are sent and received (and does not allow dupes). However, FIFO queues only allow 300 TPS (much less that regular SQS). Shoryuken works with standard and FIFO queues.
Hosting - easy to setup and cheap (pay for what you use) but obviously only available on AWS. SQS is a great choice when we need to run LOTS of jobs or when we do not care about more advanced options such as scheduling.
RabbitMQ | Amazon SQS | |
|---|---|---|
| Description | RabbitMQ gives your applications a common platform to send and receive messages, and your messages a safe place to live until received. | Transmit any volume of data, at any level of throughput, without losing messages or requiring other services to be always available. With SQS, you can offload the administrative burden of operating and scaling a highly available messaging cluster, while paying a low price for only what you use. |
| Pros | • It's fast and it works with good metrics/monitoring • Ease of configuration • I like the admin interface • Easy to set-up and start with • Intuitive work through python • Standard protocols • Durable • Written primarily in Erlang • Simply superb • Completeness of messaging patterns | • Easy to use, reliable • Low cost • Simple • Doesn't need to maintain • Delayed delivery upto 12 hours • Has a max message size (currently 256K) • Delayed delivery upto 15 mins only |
| Cons | • Needs Erlang runtime. Need ops good with Erlang runtime • Too complicated cluster/HA config and management • Configuration must be done first, not by your code | • SQS has guaranteed delivery, but messages can be delivered more than once. |
Thursday, October 26, 2017
AWS Service : Parameter Store
- Use a secure, scalable, hosted secrets management service (No servers to manage).
- Improve your security posture by separating your data from your code.
- Store configuration data and secure strings in hierarchies and track versions.
- Control and audit access at granular levels.
- Configure change notifications and trigger automated actions.
- Tag parameters individually, and then secure access from different levels, including operational, parameter, EC2 tag, or path levels.
- Reference parameters across AWS services such as Amazon EC2, Amazon EC2 Container Service, AWS Lambda, AWS CloudFormation, AWS CodeBuild, AWS CodeDeploy, and other Systems Manager capabilities.
- Configure integration with AWS KMS, Amazon SNS, Amazon CloudWatch, and AWS CloudTrail for encryption, notification, monitoring, and audit capabilities.
Monday, August 28, 2017
Jenkins - Automation Tool
- Continuous Integration and Continuous Delivery - As an extensible automation server, Jenkins can be used as a simple CI server or turned into the continuous delivery hub for any project.
- Easy installation - Jenkins is a self-contained Java-based program, ready to run out-of-the-box, with packages for Windows, Mac OS X and other Unix-like operating systems.
- Easy configuration - Jenkins can be easily set up and configured via its web interface, which includes on-the-fly error checks and built-in help.
- Plugins - With hundreds of plugins in the Update Center, Jenkins integrates with practically every tool in the continuous integration and continuous delivery toolchain.
- Extensible - Jenkins can be extended via its plugin architecture, providing nearly infinite possibilities for what Jenkins can do.
- Distributed - Jenkins can easily distribute work across multiple machines, helping drive builds, tests and deployments across multiple platforms faster.
Tuesday, June 27, 2017
Amazon CloudWatch
A metric is the fundamental concept in CloudWatch and represents a time-ordered set of data points. These data points can be either your custom metrics or metrics from other services in AWS. You or AWS products publish metric data points into CloudWatch and you retrieve statistics about those data points as an ordered set of time-series data. You can use metrics to calculate statistics and present the data graphically in the CloudWatch console. Metrics exist only in the region in which they are created.
Namespaces
CloudWatch namespaces are containers for metrics. Metrics in different namespaces are isolated from each other, so that metrics from different applications are not mistakenly aggregated into the same statistics.
Dimensions
A dimension is a name/value pair that helps you to uniquely identify a metric. Every metric has specific characteristics that describe it, and you can think of dimensions as categories for those characteristics. Dimensions help you design a structure for your statistics plan. Because dimensions are part of the unique identifier for a metric, whenever you add a unique name/value pair to one of your metrics, you are creating a new metric.
DynamoDB Data Model
Monday, May 15, 2017
AWS CodeStar
Wednesday, May 10, 2017
Amazon DynamoDB Accelerator (DAX)
- As an in-memory cache, DAX reduces the response times of eventually-consistent read workloads by an order of magnitude, from single-digit milliseconds to microseconds.
- DAX reduces operational and application complexity by providing a managed service that is API-compatible with Amazon DynamoDB, and thus requires only minimal functional changes to use with an existing application.
- For read-heavy or bursty workloads, DAX provides increased throughput and potential operational cost savings by reducing the need to over-provision read capacity units. This is especially beneficial for applications that require repeated reads for individual keys.
Monday, March 20, 2017
Amazon DynamoDB
In Amazon DynamoDB, a table is a collection of items and each item is a collection of attributes. Each attribute in an item is a name-value pair. An attribute can be a scalar (single-valued), a JSON document, or a set.
When you create a table, in addition to the table name, you must specify the primary key of the table. The primary key uniquely identifies each item in the table, so that no two items can have the same key.
DynamoDB supports two different kinds of primary keys:
- Partition Key – A simple primary key, composed of one attribute known as the partition key. DynamoDB uses the partition key's value as input to an internal hash function; the output from the hash function determines the partition where the item will be stored. No two items in a table can have the same partition key value.
- Partition Key and Sort Key – A composite primary key, composed of two attributes. The first attribute is the partition key, and the second attribute is the sort key. DynamoDB uses the partition key value as input to an internal hash function; the output from the hash function determines the partition where the item will be stored. All items with the same partition key are stored together, in sorted order by sort key value. It is possible for two items to have the same partition key value, but those two items must have different sort key values.
DynamoDB supports two kinds of secondary indexes:
- Global secondary index – an index with a partition key and sort key that can be different from those on the table.
- Local secondary index – an index that has the same partition key as the table, but a different sort key.
Amazon DynamoDB supports the following data types:
- Scalar types – Number, String, Binary, Boolean, and Null.
- Document types – List and Map.
- Set types – String Set, Number Set, and Binary Set.
Monday, February 27, 2017
AWS Step Functions
AWS Step Functions manages the operations and underlying infrastructure for you to help ensure your application is available at any scale.
With regards to pricing you only pay for the transitions, that is the steps between tasks.
Friday, February 17, 2017
Custom Authorization HTTP Request in AWS NodeJS Lambda function
/// Module to test HTTP POST Request /// Created By: Sohan Fegade /// Created Date: 17-Feb-2017 var request = require('request'); var buffer = require('buffer'); console.log('Loading http-test-module'); exports.handler = function (event, context, callback) { if (event != null) { console.log('event = ' + JSON.stringify(event)); var username = 'sampleuser'; var password = 'samplepassword'; var auth = 'Basic ' + buffer.Buffer(username + ':' + password).toString('base64'); var options = { url: 'https://www.sample-auth-url.com/oauth/token', headers: { 'Content-Type': 'application/json', 'Authorization': auth }, json: { 'type': 'test', 'input': 'test', 'field': 'test', 'scope': 'urn:scope-api', 'token-type': 'auth-token' } } request.post(options, function (error, response, body) { if (!error && response.statusCode === 200) { console.log('Access Token : ' + body.access-token); } context.callbackWaitsForEmptyEventLoop = false; callback(null, 'SUCCESS'); }); } else { console.log('No event object'); } }; |
Tuesday, January 31, 2017
AWS Route 53
Monday, January 30, 2017
Developer Guide for AWS Lambda using Node.JS
Pre Requisite:
• AWS Account
• Visual Studio
• Node.JS tool
Step 1: Create Lambda function in Visual Studio
Step 1.1 Open Visual Studio (Run as Administrator)
Add Lambda Project in Visual Studio
File -> Add New Project
Create new project as “Hello World”.
On Next screen select – Create Simple project
Click Finish.
Below screen will appear after click on Finish.
By default some files will be added in project which we can be found in Solution explorer.
- _testdriver.js : This is a utility file to help invoke and debug the lambda function. It is not included as part of the bundle upload to Lambda.
- _sampleEvent : This is JSON file use to set Event sample event data to test / debug
- App.js : Main program file in which we will write code (Application logic)
- npm : Node Package module. Utility to install NPM package
- node_modules : Repository for node.js packages. Folder contains supporting node module files. By default it contains “aws-sdk” module. When add new module it will automatically get updated and store supporting file
exports.handler : start execution of your Lambda function
Step 1.2 – Update _sampleEvent.json file
Step 1.3 – Update app.js file with below code
Step 1.4 – Run Application (Press F5), below screen should appear which contains Event information from _sampleEvent.JSON file
This complete our Hello world program.
Step 2: Deploy Lambda function in AWS console
Step 2.1: Open AWS console and find Lambda under Compute service.
Step 2.3: Screen will show list of Blueprint use to create Lambda function. We can select existing blueprint or Skip this part and move next.
Click on Skip button on screen (Bottom right corner)
Step 2.4: Configure Lambda function.
Configure function - Set Name,Description,Runtime.
Set Lambda Function code details as shown below
Code entry type: Upload ZIP file
Handler: Main JavaScript file, in our case it is app.js. Update Handler Textbox as app.handler.
Role: Set role as lambda_basic_execution
Step 2.5: Create Zip folder contains code and Node modules
To create ZIP file open Physical location of Lambda code (HelloWorld Lambda Developed in VS2013)
Select below files/folder for ZIP,
1. Node_modules
2. App.js
Step 2.6: Set Advanced settings.
Review Lambda function
Click on Create Function button. This will create your First Lambda Function.
Step 3: Configure Test Event and Test Lambda function
Step 3.1: To set Test event click on Action button and select “Configure test event” option.
Click on Test button to test Lambda function. Scroll down and you will see below content on screen.
Highlighted section in Blue is output generated by Context object.
Section highlighted in yellow is output log.
Step 4: See Test result logs in CloudWatch
Step 4.1: To check logs in click on Monitor Tab. Click “View logs in CloudWatch”
You can see details logs on new screen.


















