- Open VS Code
- Ctrl + Shift + P
- Type "user"
- Choose "Preferences: Open user Settings"
- Include following settings and restart
- Test Terminal by Ctrl + Shift +
(Command +
)
// requirements | |
// aws cli has to be installed | |
// working AWS credentials file ~/.aws/credentials | |
// copy this file as tasks.json under the .vscode directory in your templates project directory | |
// open your CloudFormation template and hit Ctrl + Shift + B | |
{ | |
"version": "0.1.0", | |
"command": "aws", | |
"isShellCommand": true, |
# PowerShell | |
$regions = "eu-west-1" | |
foreach ($region in $regions) { | |
aws cloudformation create-stack ` | |
--parameters file://$PWD\..\templates\stack_parameters.json ` | |
--tags file://$PWD\..\templates\stack_tags.json ` | |
--stack-policy-body file://$PWD\..\templates\stack_policy.json ` | |
--template-body file://$PWD\..\templates\log_bucket_template.json ` |
Param( | |
[array]$region = @( "eu-west-1") | |
) | |
foreach ($item in $region) { | |
echo $item | |
} | |
#PS> .\array_as_param.ps1 us-east-1,eu-west-1 |
def lambda_handler(event, context): | |
# Get Account Id from lambda function arn | |
print "lambda arn: " + context.invoked_function_arn | |
# Get Account ID from lambda function arn in the context | |
ACCOUNT_ID = context.invoked_function_arn.split(":")[4] | |
print "Account ID=" + ACCOUNT_ID | |
git config --global http.proxy http://myproxyserver:8080 |
# Get IAM Role name from Instance Profile Id | |
curl http://169.254.169.254/latest/meta-data/iam/info | |
# Get credentials | |
curl http://169.254.169.254/latest/meta-data/iam/security-credentials/<role-name> | |
# More info | |
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html | |
# Works both with IDLE and PTVS for Visual Studio | |
import os | |
import boto3 | |
os.environ['HTTPS_PROXY'] = '<proxyurl>:<port>' | |
s3 = boto3.client('s3') | |
s3.list_buckets() |
"s3:DeleteReplicationConfiguration" | |
does not work in bucket policies | |
s3:GetObjectVersion | |
means tha you will actually GET OBJECT = one of the object's version. |