Posts

Showing posts from August, 2013

AWS Samples Behind a Corporate Firewall

Image
The AWS Java SDK includes some interesting examples of how to use the API for a range of different use cases ( S3, SQS, SNS etc ) These work well if they are installed on a EC2 instance. However, what if you are behind a Corporate Firewall and you want the example to access the AWS services on the internet.? The Amazon S3 Client Object contains a constructor which receives a Client Configuration Object. AmazonS3Client s3Client = new AmazonS3Client(AWSCredentials creds, ClientConfiguration config) The Client Configuration object has methods to establish a proxy configuration so that the client can connect into the internet via the proxy. ClientConfiguration config = new ClientConfiguration(); config.setProxyHost("ProxyHostName"); config.setProxyUsername("ProxyUserName"); config.setProxyPassword("ProxyPassword"); If you add this type of code into a AWS Sample then you should be able to punch your way through the Corporate Fir

Dealing with Amazon Web Service Access Keys

Image
Amazon Web Services ( AWS ) access keys are required to make API calls for the range of AWS services. These keys can be troublesome, as the tendency is to hard code the values in your software ( which many internet examples do ) or to use configuration files which hold them in plain text. In many ways this is bad. The secret key once displayed to you ( as the user ) is never returned again, hence its importance can not be understated. However there is a way around this problem and its associated with AWS Identity Access Managemen t ( IAM ) roles and AWS EC2 Instance s. In the digram above an application hosted on an EC2 instance requires access to S3 Objects. If you use the AWS Java SDK you can create a S3 Client Object which has a constructor which receives the private and access keys. AmazonS3Client s3Client = new AmazonS3Client(AWSCredentials creds); The constructor for this client receives a AWSCredentials object which is built using the secret and access key.