- for files/images/web pages
- Fundamentals
- Key
- Value
- Version
- Metadata
- Subresources - bucket specific configuration
- Policies, ACL
- CORS - Cross Origin Resource Sharing
- Transfer Acceleration
- object based, not block storage
- HA, DR
- file size: 0bytes to 5 TB
- Unlimited Storage
- HTTP 200 on successful upload
- Data Consistency
- Read after Write for PUTS of new objects
- Eventual consistency for overwrite PUTS
- Amazon guarantees 99.9% availability
- Amazon guarantees 99.(11 9s) % durability
- Tiers/Classes
- Regular - can sustain the loss of 2 facilities concurrently
- Infrequent Access - low fee, but charged for retrieval
- OneZone - 99.5% availability, 20% less cost than regular
- Reduced Redundancy Storage: 99.99% durability, ex for thumbnails, may be deprecated
- Glacier: Cheap, optimized for infrequent access, takes 3-5 hours to restore data, archives
- Intelligent Tiering - unknown access patterns, data not accessed for 30+ days, moved to infrequent, after access, moved to frequent tier, optimized cost
- Frequent
- Infrequent
- Charged for:
- Storage/GB
- Requests
- Storage mgmt - inventory/analytics/tags
- Data mgmt - data taken out of S3
- Transfer acceleration
Monday, January 14, 2019
AWS Developer Associate - 2
AWS Developer Associate - 1
Normally services are first launched in US-East i.e. North Virginia region
Identity and Access Management
In here you get a custom link for your login(contains random numbers), which you can customize to any unused word you want.
Minimum security that AWS recommends:
- Delete root access keys
- Enable MFA
- Create IAM users
- Root account should not be used for anything
- Restrict access to users and give them access to what they need
- Use Groups to assign permissions
- We can also give permissions directly to users
- Apply password policy
User creation:
You get username and password for console login and access key and secret access key for API
EC2
Elastic compute cloud
Provides resizable compute capacity
Payment:
- On Demand - fixed rate by hour (linux by second) - no commitment, no upfront payment, good for learning
- Reserved - commitment for 1 or 3 year, discounted hourly rate,
- Standard RI: cost can be 75% off on demand
- Convertible RI:
- Scheduled RI:
- Spot - allows you to bid, good for flexible timings, price goes above bid, AWS will terminate and not charge, if you terminate, will be charged
- Dedicted hosts - usefull if you have server bound software licenses, regulatory requirement for no multi-tenancy
EC2 Instance types:
FIGHTDRMCPX
EBS
virtual disk
elastic block storage - attach to EC2
is replicated
EBS Types:
General purpose SSD: 10K IOPS burst upto 30K IOPS
Provisioned IOPS SSD: DB, extreme performance, >10K IOPS
Throughput optimized HDD (ST1) : no root volumne, data warehouseing, log processing
Cold HDD (SC1): file server, lowest cost, bootable
To connect to EC2, we use SSH for linux and RDP for windows
Load Balancers: Application(layer 7)/Network(most expensive/perf)/Classic(layer 7 or 4)
504 error is gateway timeout, app did not respond
Use header X-Forwarded-For to find out who the load balancer forwarded ipv4
Route53: DNS service
AWS CLI
aws configure
aws s3 ls
aws s3 mb s3://bucket
aws s3 cp hello.txt s3://bucket
User with CLI access might not need console access, dont give it
Always create groups
Secret access key will be shown only once
Dont use access key, use roles instead
RDS
ElastiCache : in-memory cache, faster than DB
Supported engines:
- Memcached
- Redis
- Automated
1-35 days recovery, stored on S3, free - Snapshot
manually, stored after RDS is deleted
Sunday, February 21, 2016
for loop in Scala
In Scala, the for is actually foreach, you write it as follows:
val filesHere = (new java.io.File(".")).listFiles
for (file < - filesHere)
println(file)
for (i < - 1 to 4) //gives 1,2,3,4
for (i < - 1 until 4) //gives 1,2,3
We can not only iterate over a sequence but also filter it as follows:
for (
file < - fileshere
if file.isFile;
if file.getName.endsWith(".scala")
) println(file)
Nested loop:
for (
file < - fileshere
if file.getName.endsWith(".scala");
line < - fileLines(file)
if line.trim.matches(pattern)
) println(file +": "+ line.trim)
Creating new collection:
def scalaFiles =
for {
file < - fileshere>
if file.getName.endsWith(".scala")
} yield file
Immutable objects
Positives:
- State does not change overtime
- Can pass them around freely
- Threads don't share an object
- Can identify an object by its hash
- Large objects result in performance hit when they are duplicated
Tuesday, December 01, 2015
Currying
So if we want to use these (mysterious) techniques, we need currying :)
Oh, and of course it gives us a different style of reuse
Sunday, November 15, 2015
while ((line = readLine()) != "") doesn't work in Scala
Pure functional languages do not have loops because of this same reason, it does not return anything
Friday, November 13, 2015
Scala Class and Object
private var sum = 0
def add(b: Byte): Unit = {
sum += b
}
def checksum(): Int = {
~(sum & 0xFF) + 1
}
}
By default sum is public, we have to explicitly make it private.
Parameter b is by default val, so we cannot re-initialize it in checksum method, there is no return keyword, in such case, last value computed by method is returned - this is the recommended style - avoid explicit and multiple return statements
class ChecksumAccumulator {
private var sum = 0
def add(b: Byte) { sum += b }
def checksum(): Int = ~(sum & 0xFF) + 1
}
since our methods are just single statements, they can be written without {}, also when method does not return anything, i.e. its return type is Unit, we can skip writing the return type and "=", like in the add method
all datatypes can get converted to Unit - it simply looses the data
semicolon at the end of the statement are optional
object ChecksumAccumulator {
}
defining object instead of class gives singleton of the class called companion object class
A class and its companion object can access each other’s private members.
To run a Scala program, you must supply the name of a standalone singleton object with a main method that takes one parameter, an Array[String], and has a result type of Unit. Any singleton object with a main method of the proper signature can be used as the entry point into an application.
object Summer {
def main(args: Array[String]) {
}
}
We can also write the following:
object FallWinterSpringSummer extends Application {
}
Thursday, November 12, 2015
Who uses functional programming
- Erlang
- Amazon
- Yahoo
- Haskell
- AT&T
- NVIDIA
- Banks - ABN Amro, BoA, Barclay, Credit Suisse, Deutche Bank, SC
- OCaml
- Bloomberg
- Scala
- Sony
- Seimens
- Clojure
- Walmart
- Citi
Why functional programming matters now
- Clock speed of processors are not increasing
- Cores on a processor are increasing
- In future we may have hundreds of cores
- Execution is no longer the bottleneck
- Memory is a bottleneck
- Foo(f(x), f(x))
- both f(x) might get executed on different cores
- it will not matter if there is no state change
- Hence functional programming
Functional Programming principles
- Functions are first class values
- pass them as parameter
- return them from a function
- store them in variable
- define function inside a function
- have function literals in the code - like int lieral 42 => anon function
- Operations should map input values to output
- Not change data in place - like what OO does
- Makes data immutable
- No side-effects => referentially transparent
Sunday, April 05, 2015
My other blogs
Wednesday, September 10, 2014
Tuesday, April 12, 2011
Saving TFS credentials
Thursday, March 17, 2011
Using Magnifier in presentations
- Windows logo key
+ Plus to zoom in
- Windows logo key
+ Minus to zoom out, and
- Windows logo key
+ ESC to exit.
Sunday, September 19, 2010
Debugging Blogspot+Silverlight+Dropbox issue
Request URL:http://dl.dropbox.com/u/4186718/Nitin.Spike.XAPHosting.xap
Request Method:GET
Status Code:200 OK
Response Headers
Content-Type:application/octet-stream
Date:Sun, 19 Sep 2010 06:12:06 GMT
Server:dbws
accept-ranges:bytes
cache-control:no-cache
content-length:4379
etag:10n
pragma:no-cache
x-robots-tag:noindex,nofollow
The problem is that the Content-Type is application/octet-stream, it should have been application/x-silverlight-app. Okay so we know the problem, how do we fix it? I am using dropbox, are they suppose to push with correct content-type or do i need to configure it somewhere... I have asked this question in their forums...
Thursday, September 02, 2010
Testing Silverlight
Saturday, August 28, 2010
Enum extensions
using System;
using System.ComponentModel;
namespace Nitin.Spike.EnumExtensions
{
class Program
{
static void Main()
{
const Colors someColor = Colors.Red;
string description = someColor.Description();
if (someColor.HasDescription())
{
if (someColor.HasDescription("indicates stop", StringComparison.OrdinalIgnoreCase))
{
Console.WriteLine("Works");
}
}
}
}
public enum Colors
{
[Description("Indicates Stop")]
Red,
[Description("Indicates Nothing")]
Blue,
[Description("Indicates Go")]
Green
}
public static class EnumExtensions
{
public static string Description(this Enum someEnum)
{
var memInfo = someEnum.GetType().GetMember(someEnum.ToString());
if (memInfo != null && memInfo.Length > 0)
{
object[] attrs = memInfo[0].GetCustomAttributes(typeof(DescriptionAttribute),false);
if (attrs != null && attrs.Length > 0)
return ((DescriptionAttribute)attrs[0]).Description;
}
return someEnum.ToString();
}
public static bool HasDescription(this Enum someEnum)
{
return !string.IsNullOrWhiteSpace(someEnum.Description());
}
public static bool HasDescription(this Enum someEnum, string expectedDescription)
{
return someEnum.Description().Equals(expectedDescription);
}
public static bool HasDescription(this Enum someEnum, string expectedDescription, StringComparison comparisionType)
{
return someEnum.Description().Equals(expectedDescription, comparisionType);
}
}
}
Saturday, July 31, 2010
High Speed Internet
The first time I connected to internet was some 9 years back, I got my own internet connection around 8 years back, and at that point of time I used to get 56 Kbps speed, and today I have a 512 Kbps line.
Is this speed enough for me? Hell no.. why not? because even today I can’t watch my videos directly off the web. Although I can watch low quality videos online, but now I want HD quality. I wonder if I will ever be satisfied with my connection.
Sunday, July 18, 2010
WPF Converter values
I posted this at stackoverflow : http://stackoverflow.com/questions/3204422/wpf-corelating-multibindings-and-converters-values
The problem was how do you handle indexes when your converter value array is of large size. I thought over it and come up with this:
https://www.assembla.com/code/TechnologyAndMe/subversion/nodes/ConverterValues
(Download complete source using a SVN client from http://subversion.assembla.com/svn/TechnologyAndMe/ConverterValues/)
So now all you have to do is :
Here Prop1,Prop2,Prop3 are the actual values that you want to pass to the converter, Value1, Value2, Value3 are just ids for Properties below them. Now in the converter, just use my BoundValues class and accessing the properties become as easy as saying :
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
var boundValues = new BoundValues(values);
return string.Format("{0} {1} {2}",
boundValues["Value1"], boundValues["Value2"], boundValues["Value3"]);
}
Where BoundValues["Value1"] returns value of Prop1, so now I no longer have to worry about managing the sequence of bindings in my XAML.

