Created
November 9, 2014 16:28
-
-
Save rhysgodfrey/6ca02df44b4a70807b88 to your computer and use it in GitHub Desktop.
Code Snippets for the AWS Quick Start Demo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################# | |
## BEFORE DEMO ## | |
################# | |
Set-AWSCredentials -AccessKey ACCESS-KEY -SecretKey SECRET-KEY -StoreAs AWSQuickStartDemo | |
Initialize-AWSDefaults -ProfileName AWSQuickStartDemo -Region eu-west-1 | |
# Script at: https://gist.github.com/rhysgodfrey/518b61873fd449406cc0 | |
.\create-vpc-and-resources.ps1 | |
# Script at: https://gist.github.com/rhysgodfrey/b62a18fe429baa2dc5b5 | |
.\create-beanstalk.ps1 | |
## Ensure some demo images are uploaded to S3 | |
################### | |
## .NET SDK DEMO ## | |
################### | |
Install-Package AWSSDK | |
##View: | |
@foreach (var image in ViewBag.Images) | |
{ | |
<div class="row" style="text-align: center; margin: 10px 0px;"> | |
<div class="col-md-12"> | |
<img src="@image" class="img-thumbnail img-responsive" /> | |
</div> | |
</div> | |
} | |
##Controller | |
public ActionResult Index() | |
{ | |
var s3Client = new AmazonS3Client(RegionEndpoint.EUWest1); | |
var objects = s3Client.ListObjects("awsquickstartdemo-s3bucket-10k61rvvok756"); | |
ViewBag.Images = objects.S3Objects.Select(o => string.Format("https://s3-eu-west-1.amazonaws.com/{0}/{1}", objects.Name, o.Key)); | |
return View(); | |
} | |
########################## | |
## CLOUD FORMATION DEMO ## | |
########################## | |
## Ensure variables are correct in create-beanstalk.ps1 | |
Initialize-AWSDefaults -ProfileName AWSQuickStartDemo -Region eu-west-1 | |
.\create-beanstalk.ps1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment